IE 7 Not Displaying Simple JS Alert?

Try clicking the "Print" button on the next page: (link removed - the consensus is that everything is working fine and the problem was in my setup) For debugging purposes, I replaced a piece of javascript with a simple warning ("test") and even that doesn't show in IE7 for me. It works fine in Safari, FF (Mac and PC) and IE6, but for some reason it doesn't work in IE7. For your reference, the code in the button:

<a onclick="makeNewWindow()" href="#"><img src="/print.gif"/></a>

      

And the JS inside /newsletter/print.js:

function makeNewWindow() {
   alert("test");   
}

      

Can anyone help me figure out if there is a way around this, or if it has something to do with running "IE7 Standalone" through Parallels on my Mac? Any help is appreciated.

Thanks, Mike

+1


source to share


6 answers


Just tested it on IE7 Vista and it worked great ... Your code looks like this too, so I think it might be a problem with your setup?



+4


source


Javascript is probably disabled in your specific IE7 setup. See this link for how to enable it: http://www.tranexp.com/win/JavaScript-enabling.htm



+3


source


could it be that it is caching an older version of the js file? try ctrl-F5

+2


source


I am guessing that you have a bug with some other javascript code that is causing your browser to simply ignore everything else.

Also you can change this code to ... onclick = "makeNewWindow (); return false" ... to avoid confusion

+2


source


This may not be the original problem, but since I had the same problem, I give my conclusion, it might be helpful to someone else.

In fact, I tested the HTML by just opening it from Windows Explorer, so I have the address file://

in the address bar.
This works great in all browsers except Internet Explorer 7 (and possibly higher).
In fact, when I opened this file in IE7, I got a warning about security issues with the local file from the script. They have so many security breaches that they are too protective ...

It looks like alert () is just disabled in this local mode and I couldn't find any security options to enable it (not too hard to search ...).
I finally dropped the file in the www directory of my local Apache installation (using WampServer 2, but possibly other distributions) and opened it via http: // localhost and the alert () behavior was ok ...

I also found that javascript:alert("Foo");

the address bar was just completely deactivated, a disgusting "design" choice ... it was just too convenient.

+1


source


The first response has been sent - i.e. use href='javascript:void(0);'

instead of href='#

'. In your case, use href='javascript:yourFunction();'

and it should work. IE seems to give priority to href over onclick (other browsers don't). Also, if you don't have the href, you will get a not found error message.

0


source







All Articles