javascript - iPhone WebApp opens links in safari -



javascript - iPhone WebApp opens links in safari -

when add together 'web app' home screen on iphone, open , click link, opens safari.

i've found couple of solutions question don't seem work:

iphone safari web app opens links in new window

$('a').live('click', function (event) { var href = $(this).attr("href"); if (href.indexof(location.hostname) > -1) { event.preventdefault(); window.location = href; } });

http://jakeboyles.com/2011/01/16/how-to-build-an-iphone-and-ipad-web-app/

<a ontouchstart="window.location=yourlink.html' ">your link</a>

both of these posts/tutorials written before ios5. there new method? doing wrong?

appreciate help

one thought create home screen app iframe, , making anchors target it. no javascript needed.

alternatively:

$('a').on('click touchend', function(ev){ $(this).preventdefault(); window.location = $(this).attr('href'); });

never utilize "touchstart" links. want observe when user stops touching link. same thing detecting key presses, mouse clicks, etc. end of event want detect.

.live has been deprecated in latest versions of jquery, utilize .on() on , wraps seamlessly around extant , non-extant elements.

javascript iphone mobile-safari web-applications

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -