![]() |
| Home | Demo | Services | Features | Help | User Forum | Blog | About | |
|
#1
|
||||
|
||||
|
There are those proponents of opening links (especially external ones) in a new window and then the a purists who think it's an abominaiton
For those who prefer the ability to open links in a new window yet keep a valid XHTML strict doctype, I stumbled onto an elegant piece of code that will allow just that. Instead of using target="_blank" on a link, use rel="external" and then have javascript that performs a little miracle. Plainly put if the visitor's browser is javscript enabled the link with rel="external" will behave like target="_blank", otherwise it's inert. See it here: http://www.sitepoint.com/article/sta...pliant-world/3 The only other little problem to solve is to be able to specify both rel="external" and rel="nofollow" - maybe like rel="external nofollow" together. I haven't looked at what if any javascript changes need to be done to allow this. I am currently using this method for all external links on www.webado.net which I have converted to xhtml strict lately and it works like a charm.
__________________
Christina >>Forum Moderator<< Please do not PM me for support. The forum is here for that. |
|
#2
|
|||
|
|||
|
I know I'm stepping out of my league here but I feel I must comment on this. Surely, coding to the highest level possible is a 'purist' activity and therefore using target=_blank is a bit of a contradiction. Rather than code to 'strict' levels and then concoct a work-around for something you're not supposed to do, wouldn't it be better to code to 'transitional' level and use target_blank in the conventional manner?
Last edited by JWJ; 11-21-2006 at 04:33 PM. |
|
#3
|
||||
|
||||
|
Well yes and no.
The "purist" idea is in my opinion a possibly wrong interpretation of the purpose this standard is meant to have. I believe it's essentially in order to help robtos crawl better since sending them off here and there with target="_blank" may be somewheat counterproductive. Other purists may have taken it to mean let user decide if a link is a new window or not - well ok, but I and possibly countless others don't go around right clicking links so that we get to pick new or same. It bugs me no end when I go to an external link and by pure force of habit I close the window after seeing it's not on the same site - and then I've ended up closing the whole thing. Anyway, it's to take or to leave. I will always open external links in new windows - and that's that. Now that I went through the exercise of converting to xhtml strict (which may have benefits other than just academic, but yet to be discovered by yours truly) I don't intend to change that habit So this is a valuable workaround for me and for anybody who wants the same thing. It can also be used in all other doctypes to accomplish the same thing. Robots will have a nice smooth crawl with no new windows and users will have the navigation I intend for them to have - whether they like it or not Oh and I did manage to modify the script to allow rel="nofollow external" and "rel="external nofollow" as well. So my script called external.js is now: Quote:
__________________
Christina >>Forum Moderator<< Please do not PM me for support. The forum is here for that. Last edited by webado; 11-21-2006 at 04:55 PM. |
|
#4
|
|||
|
|||
|
Thanks for sharing your thoughts on that.
When I was converting some pages to strict I came across this very problem. In one case I decided to go strict and dispense with the new window, in another case I decided I wanted the new window so I left the page as transitional. As far as I'm concerned 'strict' is 'strict' and 'strict' with a bit of a workaround is less than 'strict'. Of course, my approach is also a work-around .... it works around the fact that I don't know javascript. Last edited by JWJ; 11-21-2006 at 05:33 PM. |
|
#5
|
||||
|
||||
|
Quote:
Just you wait, I'm working on making colored scrollbars that even the w3c will accept - or rather ignore blissfully
__________________
Christina >>Forum Moderator<< Please do not PM me for support. The forum is here for that. |
|
#6
|
|||
|
|||
|
Purism for me is a site that works, looks right on very browser and does what's expected of it. If I get what I want but it isn't 100% valid... the site still works.
|
|
#7
|
|||
|
|||
|
Quote:
__________________
mens grooming, shaving and health |
|
#8
|
||||
|
||||
|
Quote:
__________________
Christina >>Forum Moderator<< Please do not PM me for support. The forum is here for that. |
|
#9
|
|||
|
|||
|
I really don't see the point in serving "supposedly valid" XHTML, then making it invalid via JavaScript. In fact, I avoid script like the plague as you never know if it's enabled on the client or not.
If you modify the DOM after the page is served, your page is still not valid XHTML. If browsers ever start enforcing the XML DTDs you'll see this. I think it's just fooling yourself by thinking passing the W3C Validator is the gold standard. I don't see the point of robots having a "smooth crawl". They probably don't even look at target="_blank". If they do, it's a good hint the link is external. On the other hand, I like target="_blank" and use it for external links. I'm trying to supply an external link icon which I think is the best etiquette if you're going to use target="_blank".
|
|
#10
|
|||
|
|||
|
I was to use this trick till I decided to remove all popups in my web site. If I am refererring to an external URL I have to add a pop-icon to the link : humans and search engines won't have the right to complain.
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|