13

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?

theChrisKent
  • 15,029
  • 3
  • 61
  • 62
Frank Conry
  • 2,694
  • 3
  • 29
  • 35
  • I am not able to replicate this error when placing this command alone in a document and viewing it in Chrome. Do you have any other scripts loading on the page? – Chris Baker Feb 14 '11 at 19:38
  • 3
    was the popup blocker, better popup blocker for chromium. glad to be back on the right side of the sun! – Frank Conry Feb 14 '11 at 20:23
  • 1
    Love the fact some many people jump down the poster's throat about being a bad developer. Show some love on VD [and hopefully not a VD.] :) End result was some other developer's poorly written plug-in that caused the bug. You can go rip that developer[s] a new one. lol – epascarello Feb 14 '11 at 20:26
  • 1
    If you set a variable name to "alert" you can have this problem as well. var alert = $('
    Nope
    '); alert('Message'); // Error
    – BigToach Nov 01 '12 at 20:35

3 Answers3

32

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.

epascarello
  • 204,599
  • 20
  • 195
  • 236
  • Good call. That was it. I installed better popup blocker for chromium cause last week and added an exception and it worked! Thanks! – Frank Conry Feb 14 '11 at 20:16
1

Is your Javascript enabled in the Chrome options? Other thing is any other js library included which might change default js behaviour?

Mihir
  • 66
  • 6
0

As epascarello said its because of popup blocker plugin and I faced this problem with my localhost websites and prompt method.
So i fixed it by adding my localhost url to popup blocker's whitelist: http://localhost

Jalali Shakib
  • 616
  • 8
  • 17