After loading up a Webclip with some links in it, clicking a link launches Mobile Safari instead of loading the link in the same window. Is there a way to prevent the link loading in Safari instead of the Webclip instance? I'm trying to mock up a mobile app just using PHP on my local Apache installation.
How can I load iOS webclip links in the same window?
2.5k views Asked by nipponese At
2
There are 2 answers
0
On
In addition to the option of using a single page loading new content with AJAX, you can use the JavaScript self.location=URL; return false
on hyperlinks that must stay within the application. This can be added to the HTML code directly, or with another script upon loading the page.
If you are using jQuery, I would recommend something like this:
$('a:not([target])').click(function(){
self.location = $(this).attr('href');
return false;
});
Obviously this script should be ran after the HTML has loaded, to ensure that it actually attaches to the A
elements onClick
event.
According to the Apple docs it looks like external page links will always open in Mobile Safari: