Popup JS not working in IE


I have a simple page where I am testing a “First Time Visitor” popup window. I am using CoverPop for this. http://coverpopjs.com/.

It’s a hard thing to test because as soon as you test it, you now have the cookie inserted and will have to manually remove it before testing again … very awkward. Anyway …

It works great in every browser except IE.

I was wondering if anybody knew of a work around for this. Maybe a conditional line of code that would make this work when viewed in IE?

Thanks. Here’s the page: http://www.savagepixels.com/wti/

Alternatively, maybe it would be easier to just write some javascript from scratch to do this? Is there even a way to do this consistently across all browsers using javascript? I’m not good enough at scripting yet to do that, but if somebody has a solution, I am all ears.

IE seems to not like this part of the javascript:

SCRIPT438: Object doesn’t support property or method ‘querySelectorAll’
CoverPop.js, line 52 character 9

You can use this polyfill.js file to deal with situations where the browser doesn’t know how to do querySelectorAll

What version of IE are you using?

The last FOUR versions of Internet Explorer all support querySelectorAll and the versions earlier than that are all effectively dead with almost no one using them any more - even IE9 is now effectively dead (although IE8 still has a few too many users to completely ignore - although many web sites are now moving toward letting those users see the pages the same as all the other long dead browser users see).

Of course using a polyfill means that you can still support users of prehistoric browsers where only those users have the script run extra slow because of the polyfill while everyone using modern browsers gets the full benefit of the modern coding in the script.

That would be awesome. Is it just a matter of including that file? Or does it need to be configured? I can’t seem to figure out if the whole thing should be added in the head or down underneath the markup where you’d normally put something that is DOM dependent.

Forgot to mention I have only IE 9 here.

IE9 is one of the versions of IE that supports querySelectorAll so you should not need a polyfill for that version.

That explains why it works for me and not my client. They are checking it on a version earlier I take it.

Does the polyfill work as a shim for the earlier versions? I’ll admit I have no idea what this include is doing.

Would I just include that code down underneath the popup markup?

The reason I ask is, I can’t test this myself. Or at least haven’t figured out a way. It all works on my machine but the client is saying it won’t show the popup on the earlier versions of IE.

They would need to be using IE7 or earlier for the code without the polyfill not to work.

Just include the script reference to the polyfill code with the rest of your scripts in the page. Polyfills are usually coded in such a way that they first test if the browser supports the command and only if it doesn’t do they then run their code to emulate the missing command.

Great. Thanks so much for your assistance