Sometimes my dumb mistakes are so dumb as to make me laugh.
I've always used target="_blank" in my HTML to make a link open in a new window. I like my links to external sites to open in a new window keeping my site open for the user. I think with our assumed audience that's a good idea.
But the Gardening Solutions site uses XHTML Strict, and target=_blank is apparently a no-no in XMTML Strict. Your code will not validate if you're using it. Say what you will about the purity of validation versus "the page works, why fix it?", I'm trying to play by the rules of the huge institution for which I work. I noticed the web guy who built many of these pages that I inherited used rel="external" and that seemed to work, so I did a handy-dandy search and replace and did the good-doobie thing - I replace any mention of target="_blank" with rel="external" -- not really knowing how it worked.
Guess what - now it wasn't working at all! Opening my site in IE7, I found that none of my links were opening in new windows, not even ones that had previously worked before my little s'n'r - ack!
So after a little research, I realized that rel=external only works with a little Javascript workaround (I know nothing of Javascript). I open up the file called external.js and compare the code to one I found on webmasterworld.com. (Which rocks, by the way.)
It was looking correct until one line. The correct code had:
anchor.rel="external";
My code had:
anchor.target="_blank";
My search and replace had replaced it everywhere - including the one place I needed the "wrong" code.
What makes this even more stupid is I had done the exact same thing with another piece of code a few day ago!
Ah, the adventures of an inexperienced webmaster.
New Music Friday: The best albums out Nov. 15
19 hours ago
No comments:
Post a Comment