Depricate <b> and instead put class="something" and an entry for the formatting in a stylesheet - just silly if you ask me.
Didn't know target wasn't valid.
target="_blank" is not supported under strict is because specifying that attribute acts as something presentational, which is exactlly what XHTML is NOT intended for, the same is for the "b" element.
style is done by style sheets...in XML, actually it should be possible to parse a XHTML strict document like a regular xml document...
Atari ST fan
Gender:
Posts: 8
56 credits Members referred : 0
« Reply #6 on: Aug 11, 2007, 05:09:44 PM »
I was looking for an answer to this a month or two ago. It seems such a pain to have to use javascript when there could be such an easy way to do it in the HTML. Still haven't found a better answer though. And this is why I, and so many other people, use XHTML transitional even though the standards nazis look down their nose at it.
Global Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6280
38506 credits Members referred : 374
I was looking for an answer to this a month or two ago. It seems such a pain to have to use javascript when there could be such an easy way to do it in the HTML. Still haven't found a better answer though. And this is why I, and so many other people, use XHTML transitional even though the standards nazis look down their nose at it.
if you need the blank target use a different doc type
This is probably the shortest use of javascript to do this, however its a little on the ugly side and will return errors in a WAI audit (its valid as it degrades but will be flagged as a potential problem)
While not getting into the is dom hierarchy structure or presentation debate, XHTML strict is there for a reason if you need to hack it with Javascript I guess you have to ask why you are doing it. (I still do anyway!)
Kill the googlebot
Posts: 6
40 credits Members referred : 0
« Reply #9 on: Nov 06, 2007, 07:29:57 PM »
It's easier to just don't use target=_blank.
I mean, it's the user who decides if the window will open in another window or not. What you should do is include (by CSS) a little icon on the link to warn the user in case of a external link (oh, and don't forget the "rel=external" attribute on the <a> tag)
Community Supporter?
Hunky Junky Monky Man!
Gender:
Posts: 68
436 credits Members referred : 0
Schwa?
« Reply #10 on: Jan 03, 2008, 03:43:48 AM »
I would just like to add to daquino's post: if you create your a tags with 'rel="external"', you can write a script that will read in all of the tags (think: document.getElementsByTagName('a')) and check their rel attribute. Then, you can add an onclick handler that will open a new window with the source of 'this.href' which is to point to the current a tag's url - and then of course return 'false' so the URL doesn't execute.
Tim Nash
Global Moderator Community Supporter?
Internet Junkie
Posts: 2172
5030 credits Members referred : 2
Venture Skills - New Media & IT group
« Reply #11 on: Jan 03, 2008, 11:48:55 AM »
Just like the URL I posted 2 posts up as the preferred option.
The good news for those _blank lovers is it is in the html5 specs the bad news its not in the new xhtml specs so when the world decides which way it will go we might not need such hacks. Though it is worth remembering that many users find opening new windows very annoying unless their is a good reason. If you are worried your content is not good enough for them to come back perhaps you might want to look at that before implementing _blank of course their are dozens of other reasons as well many completely valid.