h5bp/mobile-boilerplate

Empty anchors issue in IOS webapp

MarkDijkstra opened this issue · 5 comments

The script thats included in the index.html file that prevents the opening link into safari(webapp mode) cant handle empty anchors. If the anchor if empty(href="#") and you press it. the page will go to the top or bottom of the page.

Any fix for this?

That sounds like the standard behaviour for href="#". If you're using that value for JS, and want to prevent the default behaviour, then you need to use preventDefault().

All links that have a an empty value in my plugins do have an preventDefault, so this isn't an solution, as the links work perfect in the browsers on and device(mobile to desktop). The script used to prevent from using safari seems to be the issue. So the script should skip empty anchors.

The same issue occurs if i use a tabs plugin, with anchors like #tabs1, #tab2 etc. The script should skip these kind of anchors.

I'm seeing this empty link behaviour even without using the script (iOS6)? Seems to be default behaviour in iOS web app mode, rather than an issue with the MBP helper?

Ok, am going to close this issue unless any more info comes to light. As far as I can see this behaviour is related to web app mode on iOS, rather than anything in MBP itself.