Hey, I was working on my site and then I went to validate it at W3C when I discovered that the "target" attribute has been depredicated. I was wundering if there is another non-javascript way to open a link in a new window? I don't want it this way for all my links but just links I put the code on. I will appreciate any help. As a matter of fact, CSS3 will have this (<!-- m --><a class="postlink" href="http://www.w3.org/TR/2004/WD-css3-hyperlinks-20040224/">http://www.w3.org/TR/2004/WD-css3-hyperlinks-20040224/</a><!-- m -->) as a part of it. However, that's still quite a while away considering that it's still a working draft and moreover, it'll take a while for browser vendors to implement it.
It's perfectly fine to use JavaScript for this kind of thing if you do it correctly (i.e., make sure it's degradable). An example of doing it correctly would be like this:<a href=http://www.webdeveloper.com/forum/archive/index.php/"http://www.google.com/" onclick="target='_blank';">Google</a>For users with JavaScript, a new window opens; for users without, it acts as a normal link. No harm done (well, kind of — you shouldn't open new windows (<!-- m --><a class="postlink" href="http://www.diveintoaccessibility.org/day_16_not_opening_new_windows.html">http://www.diveintoaccessibility.org/da ... ndows.html</a><!-- m -->) in the first place).Well see the only links this code will be on is links to external sites. Like for my portfolio page for example. I want it to open in a new window so they can preview sites that I have built and I don't want them to get stuck there like for example if the site I designed is on a free server there could be pop-ups and ads and if it overwelms the user their first response is usally to close all the windows to get rid of all the pop-ups and if they close the main window it will close the window they were browsing my site in which will make them less likely to go to all the trouble to open a new browser window and go back to my site again. If I have it open in a new window then if they run into pop-up problems they will just be able to close the pop-up that they opened and still be able to browse my site. So you see I don't believe that in my piticular situation that it is bad to have it open a new window. Forgive what may be a silly question, but surely the 'target' attribute must still be required...what about users with JS disabled! Also, is it not the case that CSS3 is/will not be supported by many browsers for sometime. Forgive me if this is a stupid question.....just wanted to make sure that I understand this correctly.
At the moment I'm thinking that the target attribute has been deprecated without a reasonable replacement?Originally posted by screaming_banjo
Forgive what may be a silly question, but surely the 'target' attribute must still be required...what about users with JS disabled! Also, is it not the case that CSS3 is/will not be supported by many browsers for sometime. Forgive me if this is a stupid question.....just wanted to make sure that I understand this correctly.
At the moment I'm thinking that the target attribute has been deprecated without a reasonable replacement?
Do users without JavaScript really need the pages to open in new windows?
[J]ona
It's perfectly fine to use JavaScript for this kind of thing if you do it correctly (i.e., make sure it's degradable). An example of doing it correctly would be like this:<a href=http://www.webdeveloper.com/forum/archive/index.php/"http://www.google.com/" onclick="target='_blank';">Google</a>For users with JavaScript, a new window opens; for users without, it acts as a normal link. No harm done (well, kind of — you shouldn't open new windows (<!-- m --><a class="postlink" href="http://www.diveintoaccessibility.org/day_16_not_opening_new_windows.html">http://www.diveintoaccessibility.org/da ... ndows.html</a><!-- m -->) in the first place).Well see the only links this code will be on is links to external sites. Like for my portfolio page for example. I want it to open in a new window so they can preview sites that I have built and I don't want them to get stuck there like for example if the site I designed is on a free server there could be pop-ups and ads and if it overwelms the user their first response is usally to close all the windows to get rid of all the pop-ups and if they close the main window it will close the window they were browsing my site in which will make them less likely to go to all the trouble to open a new browser window and go back to my site again. If I have it open in a new window then if they run into pop-up problems they will just be able to close the pop-up that they opened and still be able to browse my site. So you see I don't believe that in my piticular situation that it is bad to have it open a new window. Forgive what may be a silly question, but surely the 'target' attribute must still be required...what about users with JS disabled! Also, is it not the case that CSS3 is/will not be supported by many browsers for sometime. Forgive me if this is a stupid question.....just wanted to make sure that I understand this correctly.
At the moment I'm thinking that the target attribute has been deprecated without a reasonable replacement?Originally posted by screaming_banjo
Forgive what may be a silly question, but surely the 'target' attribute must still be required...what about users with JS disabled! Also, is it not the case that CSS3 is/will not be supported by many browsers for sometime. Forgive me if this is a stupid question.....just wanted to make sure that I understand this correctly.
At the moment I'm thinking that the target attribute has been deprecated without a reasonable replacement?
Do users without JavaScript really need the pages to open in new windows?
[J]ona