javascript in mobile web browsers

I have this very simple html file.

<!doctype html>
<html>
<head>
</head>
<body>
<script>alert("hi");</script>
</body>
</html>

This usually runs fine in Firefox and Google Chrome on my laptop. But when I run this in Safari in an iPhone device and Google Chrome on an Android device, the JavaScript code doesn't run. That is, no alert appears. This is extremely unusual for me. Do we need to change JavaScript code when running on mobile devices? What should I do?

Answers


(function(){
  window.alert('hi')
})()
<html>
  <head>
  </head>
  <body>
  </body>
  <script src="aJSfile.js"></script>
  
</html>

Need Your Help

Wait a time - Android

android wait

I want that my program wait 10s in my while true, but it doesn't work

Filter form based on unbound control value

forms ms-access ms-access-2013

I have a form bound to a query, except for one field that I am leaving unbound. The idea is that the user will enter a value in that textbox and press a button to bring up the record. I have some c...