I hate client-side scripting!

Hate’s a strong word, but appropriate.

I was working on a quick little script to show/hide the answers to a quiz (not going live till Sunday) that a co-worker was creating.

She wanted to do this with a pop-up window, for each answer to tell if you were right or wrong. I told her to let me have a stab at it since pop-ups are evil, I had been looking for an excuse to do some Javascript/CSS funness, and, did I mention, pop-ups are evil.

So a quick little script to check an item’s display property, and it’s all done except for the testing right?

Well everything worked OK in every browser I could test, except IE6/PC. Mr. NN4 Jr. there wouldn’t behave.

Oh, it’d change the style all right, but it’d still send you on the href specified in the link.

I couldn’t figure out why. I Googled, I Evolted, I screamed!

I couldn’t find any circumstance under which IE6/PC would ignore a “return false” statement — which negates any href in an anchor element when returned by an onclick event.

Then, on a whim, my eyes darted to the tray.

I have seen the enemy, and his name is Free Surfer.

It’s a little pop-up blocker that works in IE/PC… and, so it seems, also forces IE to follow a link despite a “return false” from a Javascript function.

I disabled it, my script worked, all is well.

But how many other pop-up blockers, or browser “enhancements”, do this, too. If it’s alot then that’d block a very nice, very usable solution… to provide some DHTML for those who can use it but also provide a backup URL for those who can’t.

Edit 4:17 p.m.: Opera 7 obeys both the script call to change the CSS and the link.

This entry was posted in Web design. Bookmark the permalink.