If you are of the Internet Explorer browsing persuasion, you may have noticed that often, when I quote another website, the style of the font will be in italic but there won’t be any quotes around the reference. I released a change to the site today that should take care of this issue.
The problem was that Internet Explorer—all the way up to version 6.0—does not fully support a tag standard that has been around for about five years now, namely: the <q> tag. According to the W3C specification, the browser is required to put quotes around anything surrounded by this tag. Mozilla does it, as does Opera. IE does not.
Mark Pilgrim has addressed this issue before, initially offering a CSS solution, but eventually settling for some server-side scripting that would insert the HTML quote entities en masse throughout his site. While this is probably an ideal solution, server-side scripting—even of the MT-Plugin variety—is not something that I have taken the time to learn.
Today, though, Mark provided links to JavaScript solutions provided by Simon Willison and Stuart Langridge. While the Willison solution involved proprietary IE scripting, Langridge took it one step further to make it more standards-friendly. Both of these implementations got the ball rolling for me and after hacking around for a little under an hour, I came up with this code:
function checkQuotes ()
{
quotesElements = document.getElementsByTagName(“q”);
if (quotesElements.length > 0) {
q=quotesElements[0];
if (q.currentStyle) {
s = q.currentStyle;
} else if (document.defaultView && document.defaultView.getComputedStyle) {
s = document.defaultView.getComputedStyle(q,”);
}
supportsQuotes = false;
for (prop in s) {
if (prop.toLowerCase() == ‘quotes’) {
supportsQuotes = true;
break;
}
}
if (!supportsQuotes) {
for (var i=0; i<quotesElements.length; i++) {
q = quotesElements[i];
q.innerHTML = ‘“’+q.innerHTML+’”’;
}
}
}
}
According to this code, any browser that supports the quotes will simply implement the CSS rules that I got from reading Mark’s article. Those that don’t, like Explorer, will have them dynamically added to each q element in the page.
I’ve tested this in my limited “QA” environment, and it works without error in the Mozilla variants, Opera 7, and Internet Explorer 6.0—which includes quite a chunk of the internet community. Netscape 4.76 did generate an error, however, quietly whining that the document.getElementsByTagName function does not exist.
Thanks to Mark, Simon, and Stuart for their work. Click here to see an article that employs the <q> tag.

The block of code you´ve posted includes two alert() functions which are not needed (and indeed not included in global.js) you might want to remove.
Daniel, thanks. The alert statements were used for debugging and, of course, were yanked from the final revision of the code. I pulled them here, too.
This raises the question of “do we care about netscape 4.x?”
unfortunately, for many of us that develop web-based-software for work, the answer is “yes”
many, MANY, people still use netscape 4.x because it is what they know. They find that things “look funny” in netscape 6 and 7, and won’t give or don’t know about mozilla. This same crowd typically seems to hate MS-IE and won’t use it either.
Ironically, i’ve noticed that 90% (yes, i keep track
) of the netscape 4.x crowd comes from the engineering sector of campus. You’d think they’d be able to handle using a modern browser … or perhaps, because their profession is so old they know the value of “tried and true”
What ever the reason, it is a real thorn in my side sometimes.
Altp.
Hey Mike. Yeah, I had covered this in a previous blog, when I decided to start supporting NN4 to a limited extent. My attitude is much like the attitude at A List Apart, which is: “we’ll make our site accessible to you, but that doesn’t necessarily mean we’ll make it attractive to you.” I’ll probably get around to fixing the quotes bug in Netscape, but—since no one visits this site using Netscape 4—it certainly won’t happen anytime before school’s over.
Speaking of “alternative” browsers, I’m happy to report that this site renders beautifully from Safari running on a 17″ iMac. The bad news is that the quotes fix doesn’t work in Safari. =^P
Well, maybe a safari user will report it to apple then … they seem to be big on making the world most perfect browser …
it may even be enought o make me switch to konquer on linux instead of gecko … that is, if anyone makes a decent interface
Altp.
Quick note on Safari: it appears to work now. (Version 1.0, build 85)
all good and well, but safari misses at least one major object, that’s the DOM getComputedStyle / IE currentStyle one… so it’s rather not the perfect browser yet (and i didn’t mention the limited form / input field layout possibilities yet).
I should mention that this entry has been superceded by this:
http://www.kennsarah.net/archives/000251.shtml
Since May 9th, Brad Choate’s MT Macros plugin automatically appends the curly quotes on this site.
Hum. Since you then changed the way things are done on your site, can you post the latest version that worked?