lowdow — 2010-03-03T03:55:43-05:00 — #1
I've attached a JS program to this thread.
What it should do is, once click on a link with the paticular class, the browser should alert you that you are leaving the site.
I've declared in the program the code needed to work in IE.
I have tested it in various browsers and it works, but I can't seem to find the problem why its not working in IE. When the browser loads the html file it does say that the active content is blocked, but you can click a popup window to allow the active content - which I did.
stomme_poes — 2010-03-03T04:36:54-05:00 — #2
When the browser loads the html file it does say that the active content is blocked, but you can click a popup window to allow the active content - which I did.
Weird, it doesn't do that for plain ol' JS. Is there something more than JS involved here?
lowdow — 2010-03-03T04:51:21-05:00 — #3
No, I'm only loading a html file. And in this is a script link to the "core.js" & the "script.js".
stomme_poes — 2010-03-03T05:45:13-05:00 — #4
If it's not ginormous, can you just post it here in [code] tags?
But that click-to-activate looks really suspicious... IE does that with Flash and Active X sometimes... but plain ol' JS shouldn't, really.
Sitepoint has a popup that asks are you sure you want to log out? Which I normally don't see as I have JS off. So, they do it in a way that works with IE.
I suppose, just to be sure you don't have some wiggy security setting in your IE, can you verify that SitePoint's popup works for you in IE?
lowdow — 2010-03-03T05:56:32-05:00 — #5
Here's the code:
var Anchor =
var link = Core.getElementsByClass("leaveSite");
for (var i = 0; i < link.length; i++)
if (typeof link[i].addEventListener != "undefined")
link[i].addEventListener("click", Anchor.clickListener, false);
else if (typeof link[i].attachEvent != "undefined")
if (typeof event == "undefined")
event = window.event;
if (!confirm("Are you sure you want to leave this site?"))
event.returnValue = false;
lowdow — 2010-03-03T10:45:55-05:00 — #6
Found the problem!
When I define the event listener for ie, it should say:
stomme_poes — 2010-03-03T12:51:31-05:00 — #7
Heh, you got it!
IE still likes the old "on" prefix while everyone else does not like it.
Glad you figured it out.