I run a web page in iPhone Safari. The page has a button. on clicking it, will show an alert message box. This is OK. Then, I change or add # hash URL by typing in the address bar, then, alert message box stop working. I click the button, and nothing happens. No javascript error but no alert message box.
Is this iOS Safari known issue?
Please share your thoughts and the solution you have come up with. Many Thanks!
$(".button").click(function () {
alert('Hello');
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.2.3/jquery.min.js"></script>
<input class="button" type="button" value="alert" />
Note:
- This is not quite due to my code. I have also tested at Here
- I have tested in the most recent iOS versions.
- Javascript itself is working
- Not JQuery issue, plain JS code also does not work
- An alert box is working in iPhone Chrome or other browsers