Title: Valid XHTML
Last modified: August 18, 2016

---

# Valid XHTML

 *  [carnold](https://wordpress.org/support/users/carnold/)
 * (@carnold)
 * [20 years, 3 months ago](https://wordpress.org/support/topic/valid-xhtml-3/)
 * OK, i have some links that i need to open in a new browser window. The target
   =”_blank” opens the links in new windows but is not valid! I have also tried 
   this new link…This does not open in a new windows. Also tried this Some Other
   Site….this does not open in a new window. I also tried declaring a new DTD, this
   gave me even more validations errors. How in the world do you open a new browser
   windows and stay XHTML valid?
 * Umm, sorry, i had a typo 🙂 onclick now works

Viewing 6 replies - 1 through 6 (of 6 total)

 *  [spencerp](https://wordpress.org/support/users/spencerp/)
 * (@spencerp)
 * [20 years, 3 months ago](https://wordpress.org/support/topic/valid-xhtml-3/#post-348519)
 * Are you sure when adding a link with that target=”_blank”, it looks something
   like this:
    `<a href="http://maddox.xmission.com/" target="_blank">Maddox</a>`
 * Just was curious, cause I don’t see why it’s not passing validation…it’s not 
   spitting out errors for me on my blog, for that… :/
 * spencerp
 *  [niziol](https://wordpress.org/support/users/niziol/)
 * (@niziol)
 * [20 years, 3 months ago](https://wordpress.org/support/topic/valid-xhtml-3/#post-348533)
 * This little bit of javascript does the trick for me, just change the domain to
   match your own, but beware that it opens ALL links outside the specified domain
   in a new window, but since it’s all javascript, it is fully valid up-to and including
   XHTML 1.1.
 * `function makeNewWindows() {
    if (!document.links) { document.links = document.
   getElementsByTagName('a'); } for (var t=0; t<document.links.length; t++) { var
   extlinks = document.links[t]; if (extlinks.href.search(/http/) != -1) { if (extlinks.
   href.search('/www.DOMAIN.com/') == -1) { extlinks.setAttribute('target', '_blank');}}}}
   window.onload = function(e) {makeNewWindows();}
 * function clearDefault(el) {
    if (el.defaultValue==el.value) el.value = "" }
 * Cheers,
    Michael.
 *  Thread Starter [carnold](https://wordpress.org/support/users/carnold/)
 * (@carnold)
 * [20 years, 3 months ago](https://wordpress.org/support/topic/valid-xhtml-3/#post-348559)
 * @spencerp-yours may not be of the “strict” type, not sure but mine was of “strict”
   and it did not validate.
 * @niziol-Thanks for that bit of code—much appreciated!!
 *  [spencerp](https://wordpress.org/support/users/spencerp/)
 * (@spencerp)
 * [20 years, 3 months ago](https://wordpress.org/support/topic/valid-xhtml-3/#post-348567)
 * _@spencerp-yours may not be of the “strict” type, not sure but mine was of “strict”
   and it did not validate._
 * Oh ok..I didn’t dig too deep on that, just was posting a quicky type response
   that I thought was of “some” possible help, suggestion or whatever.. =)
 * niziol, thanks for posting that as well. =) Going to bookmark this thread for
   later reference purposes.. =)
 * spencerp
 *  [niziol](https://wordpress.org/support/users/niziol/)
 * (@niziol)
 * [20 years, 3 months ago](https://wordpress.org/support/topic/valid-xhtml-3/#post-348574)
 * My pleasure!
 * the target=”blank” attribute will validate with XHTML 1.0 Transitional, but not
   with anything above that (such as string or XHTML 1.1). 🙂
 * Cheers,
    Michael.
 *  [spencerp](https://wordpress.org/support/users/spencerp/)
 * (@spencerp)
 * [20 years, 3 months ago](https://wordpress.org/support/topic/valid-xhtml-3/#post-348582)
 * _the target=”blank” attribute will validate with XHTML 1.0 Transitional, but 
   not with anything above that (such as string or XHTML 1.1). 🙂_
 * Thanks for clarifying that.. 🙂 I guess I was just so used to using the XHTML
   1.0 Transitional that I didn’t realize it. But now I know and I’ll remember it
   and this post for reference purposes then..lol. 🙂
 * That point is well noted, I have just tried it on my [Test Blog3](http://www.vindictivebastard.net/blog3/)
   using this:
    `<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://
   www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">`
 * And just recieved that [validation error](http://validator.w3.org/check?uri=http%3A%2F%2Fwww.vindictivebastard.net%2Fblog3%2F)
   as well. =) Thanks again niziol, and I’ll remove that target=”_blank” then after
   awhile.. =)
 * spencerp

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Valid XHTML’ is closed to new replies.

 * In: [Everything else WordPress](https://wordpress.org/support/forum/miscellaneous/)
 * 6 replies
 * 3 participants
 * Last reply from: [spencerp](https://wordpress.org/support/users/spencerp/)
 * Last activity: [20 years, 3 months ago](https://wordpress.org/support/topic/valid-xhtml-3/#post-348582)
 * Status: not a support question

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
