Hi,
I am using the following code to open a blank page however this creates an HTML error.
Does anyone know the correct code to open a blank page. Im sure this used to work fine.
Code:target="_blank" class='venuelink'
| SitePoint Sponsor |




Hi,
I am using the following code to open a blank page however this creates an HTML error.
Does anyone know the correct code to open a blank page. Im sure this used to work fine.
Code:target="_blank" class='venuelink'

Run for cover!
This no longer validates as it is considered bad practice. You are forcing the user to open a new window and you should really leave that decision up to the user. It also breaks back button functionality etc.





When you say "HTML error", are you referring to a validation error? target="_blank" is correct for HTML but is invalid for XHTML.
http://www.w3schools.com/tags/att_a_target.asp
If you are using XHTML, you will have to use Javascript to open your target in a new window in order for it to validate. Like this:
Complete link would be:Code:onclick="window.open(this.href,'_blank'); return false;"
The "return: false;" part is important.Code:<a href="http://www.sitepoint.com/" onclick="window.open(this.href,'_blank'); return false;">Sitepoint</a>
You could also do something similar to this:
http://www.thefutureoftheweb.com/blo...-blank-xhtml11




Brilliant thanks, do I need to add anything to the head to allow it to recognise the Javascript?Code:<a href="http://www.sitepoint.com/" onclick="window.open(this.href,'_blank'); return false;">Sitepoint</a>
Im using it on a directory which a blank window would work better.

Try to use sparingly: Should links open in new windows - http://uxdesign.smashingmagazine.com...n-new-windows/
Bookmarks