2

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?

Lucy Ford
  • 23
  • 5
  • possible duplicate of [Javascript Alert Boxes not working in Chrome](http://stackoverflow.com/questions/4996394/javascript-alert-boxes-not-working-in-chrome) – Josh Aug 30 '12 at 16:47

1 Answers1

2

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.

heretolearn
  • 6,387
  • 4
  • 30
  • 53