March 12, 2004

I hate client-side scripting!

Hate’s a strong word, but appropriate.

I was work­ing 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 look­ing for an excuse to do some Javascript/CSS fun­ness, and, did I men­tion, pop-​ups are evil.

So a quick little script to check an item’s dis­play prop­erty, and it’s all done except for the test­ing right?

Well every­thing 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 spec­i­fied in the link.

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

I couldn’t find any cir­cum­stance under which IE6/PC would ignore a “return false” state­ment — which negates any href in an anchor ele­ment 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 dis­abled it, my script worked, all is well.

But how many other pop-​up block­ers, or browser “enhancements”, do this, too. If it’s alot then that’d block a very nice, very usable solution… to pro­vide some DHTML for those who can use it but also pro­vide 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.

Filed under: Web design

Next:
Previous:

Related

Comments