Note that there are some explanatory texts on larger screens.

plurals
  1. POUIWebView behaviour with maps
    primarykey
    data
    text
    <p>I have a UIWebView in my application that loads a mobile website. The mobile website then has lots of different links.</p> <p>One of those links will try and load a map using Google Maps.</p> <p>Initially, I had a problem where the user clicked the maps link, as the application would try to load the maps inside my webview. What this does, is make the user stuck, as once you've loaded maps inside the webview, there's no way to go back.</p> <p><img src="https://i.stack.imgur.com/hlCv6.png" alt="enter image description here"></p> <p>The only way for you to the go back, is by force closing the application, so not ideal.</p> <p>I then found other people having the same problem, and implemented the solution as described <a href="https://stackoverflow.com/a/7680096/279395">here</a>.</p> <p>This worked great, and now upon clicking the map link, it opens up the maps application. In order to go back to the original application, I can simply double tap the home button, and select my application on the list of running applications.</p> <p>However, this brought another problem. When I select my application again, it briefly displays the contents back, and then opens the following popup:</p> <p><img src="https://i.stack.imgur.com/5VLtd.png" alt="enter image description here"></p> <p>No matter what you chose there, it then loads up the maps again, but inside of the webview this time, which negates all the work done as described previously.</p> <p>Has anyone here seen this kind of behaviour, and if so, do you know how to go around it, so it doesn't even open the popup asking for your current location?</p> <p><strong>UPDATE</strong> Adding the code I;m using to handle it</p> <pre><code>- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType{ // URL Starts with "http://maps?" if([[request.URL description] hasPrefix:@"http://maps"]){ [[UIApplication sharedApplication] openURL:request.URL]; return NO; } // otherwise let the webview deal with the request return YES; } </code></pre> <p>Thanks in advance,</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload