I had tried to use alert, prompt and result:
- If I open html file (address bar: file:///C:/…./index.html), it worked, a dialog box appeared.
-
If I place html file, javascript file at webapps folder of Tomcat, and open index.html via localhost:8080, it didn’t work.
An error: Uncaught TypeError: Property ‘alert’ of object [object Window] is not a function
Why and how to fix it?
Do you have a pop up blocker plug-in installed? If you do, disable/remove it and see if the error goes away.
OR
Somewhere in your code you overrode alert. Check for var alert = … or some other kind of declaration like that. Also check for window.alert declarations.