I have this code in my page:
<a href onClick="return false;">Press me!</a>
The link is placed inside a span with a useful onClick event.
Now, in Chrome and Firefox this works perfectly. The link is clicked, the useful event is executed and everybody’s happy. In iOS (iPhone and iPad) using the default Safari browser, this fails miserably – after the link is clicked the whole page is reloaded and the useful event is never executed.
I also tried
<a href="#" onClick="return false;">Press me!</a>
Which I understood to be the wrong way of doing this. In Chrome and Firefox it works well, but in iOS’ Safari it jumped back to the beginning of the page (but it DID execute the useful event, so in a sense it was better).
What am I missing?
From your description, it seems like a bug in iOS browser JS implementation (maybe create a minimal code to demonstrate it?).
A simple workaround would be to replace the
<a href...>with<span style="cursor:pointer;">.