Skip to content

Instantly share code, notes, and snippets.

@bright-spark
Forked from cjanis/gist:3908053
Last active September 16, 2015 23:13
Show Gist options
  • Select an option

  • Save bright-spark/41330c65a4bec51ec62b to your computer and use it in GitHub Desktop.

Select an option

Save bright-spark/41330c65a4bec51ec62b to your computer and use it in GitHub Desktop.
Prevent internal links in iOS standalone web apps from opening in Mobile Safari
if (window.navigator.standalone) {
var local = document.domain;
$('a').click(function() {
var a = $(this).attr('href');
if ( a.match('http://' + local) || a.match('http://www.' + local) ){
event.preventDefault();
document.location.href = a;
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment