Computer Science, asked by sahilsamahu5633, 1 year ago

How does mobile safari determine when to prompt the user to share location in HTML?

Answers

Answered by Shaswata13
0

I have an app, and I'd like to redirect the users to different pages based on where they are navigating from.

If navigating from web clip, do not redirect. If navigating from mobile Safari, redirect to safari.aspx. If navigating from anywhere else, redirect to unavailable.aspx

I was able to use iPhone WebApps, is there a way to detect how it was loaded? Home Screen vs Safari? to determine if the user was navigating from a web clip, but I'm having trouble determining if the user navigated from mobile Safari on an iPhone or iPod.

Here's what I have:

if (window.navigator.standalone) {

   // user navigated from web clip, don't redirect

}

else if (/*logic for mobile Safari*/) {

   //user navigated from mobile Safari, redirect to safari page

   window.location = "safari.aspx";

}

else {

   //user navigated from some other browser, redirect to unavailable page

   window.location = "unavailable.aspx";

}

Similar questions