Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript Alert Boxes not working in Chrome

This is weird, The following line of javascript:

alert("test");

gives the following error in chrome:

Uncaught TypeError: Property 'alert' of object [object DOMWindow] is not a function

It also breaks when using a prompt. Oddly it works in firefox. Any ideas?

like image 429
Frank Conry Avatar asked Feb 14 '11 19:02

Frank Conry


People also ask

Why alert is not working in Chrome?

Go to Settings > System > Notifications & actions and make sure the Notifications option is toggled on. Afterward, scroll to the Get notifications from these senders section and make sure Google Chrome is toggled on.

Why is alert on JavaScript not working?

The reason alert() does not work is because previously you have checked "prevent this page from creating additional dialoug" checkbox. lets take a look at this code. There will be two alert boxes if you run the code.


1 Answers

Do you have a another pop up blocker plug-in installed on Chrome? If you do, disable/remove it and see if the error goes away.

like image 182
epascarello Avatar answered Oct 12 '22 23:10

epascarello