Forum Moderators: open
targetattribute is only valid for a Transitional (loose DTD) DOCTYPE. You cannot specify a target (to open a new window, ie. target="_blank") if you have to validate to a Strict DOCTYPE, which you are doing.
A way to get around this might be to use JavaScript in the onclick event of the anchor to
window.opena new window...?
Does anyone know why this feature is removed from xhtml 1.0 strict?
I'm guessing... in the interests of accessibility and removing presentation/behaviour from content... the target attribute is only really relevant for screen rendered content (?)
I guess I'll go back to html 4.01 strict
HTML 4.01 Strict is the the same as XHTML 1.0 Strict in this respect - you need to drop back to Transitional (XHTML or HTML).
no version of HTML strict has ever included the target attribute.[w3.org...]
The target attribute is intended for frameset DTDs.
no version of HTML strict has ever included the target attribute.
If this is the case, then that means all visitors clicking on any outbound links will definitely leave your site since the url won't open in a new window.
Hmmm... have you guys come across this problem before? Did you compromise by using HTML transitional?
There's a suggestion earlier to use javascript to open a new window. However, this means that visitors with script blockers won't have the content opening in a new window.
Any other suggestions?
One way to cater to folks with javascript turned off (and I believe the stats on that traffic segment are heavily inflated by bot traffic) is to serve a regular link, then an onclick javascript function with "return false" so the main page doesn't reload also when javascript is enabled.
<a href="newpage.html" onclick="popup('newpage.html','variable options');return false;">link text</a>
<a href="newpage.html" onclick="popup('newpage.html');return false;">link text</a>
I tried to implement this but it doesn't work. The furthest I can go is this..
<a href="newpage.html" onclick="javascript:window.open('newpage.html'); return false;">
if "onclick popup" can cater to visitors with javascript turned off, then i'd assume that onclick popup is not a javascript. If it's not javascript, then what is it?
Is there any other code that I need to insert before <a href="newpage.html" onclick="popup('newpage.html');return false;">link text</a>
if "onclick popup" can cater to visitors with javascript turned off, then i'd assume that onclick popup is not a javascript. If it's not javascript, then what is it?
The onclick event doesn't cater to visitors with javascript turned off - it caters to visitors with javascript turned ON. The href attribute caters to those who have javascript turned off - for those few, they won't get a popup, it will just be a regular link! "popup()" would be a javascript function that you would have to write yourself (as tedster suggests) - it is not a built-in javascript function. It would perhaps call the built-in window.open() function (a method of the window object).
You could call the window.open() function directly, like you have done, but if you have many popups it may be easier in the long run to write a function.
1. Will it hurt my SEO if i have javascript in my HTML?
2. If I don't use javascript and instead use target="_blank", and my page doesn't validate, will it hurt my SEO?
1. In this case, no. SE's generally/always ignore javascript. If, however, you used javascript to create page content/site navigation, then it probably would effect your SE rankings - as it would be as if it didn't exist!
2. I doubt it.