Jump to content

New window in pure XHTML?


Azu

Recommended Posts

Hi, can someone please tell me a way to make a link open in a new window in pure XHTML (not javascript/flash/activex)? I'd really really really appreciate it ^^ I've been trying to figure this out on my own for a while and I give up..

 

Oh and it would be even better if it would open in a new tab instead of a new window since new windows can be confusing..

Link to comment
https://forums.phpfreaks.com/topic/69427-new-window-in-pure-xhtml/
Share on other sites

<a href="http://www.anothersite.com" title="What ever" onclick="window.open(this.href); return false;" onkeypress="window.open(this.href); return false;">link text</a>

 

ideally you should actually keep these eventtrigger attributes out of the html all together and use javascript to add the triggers...

well if you use strict ahtml then you should stick to the standards.  The standards state that a new wondow is a document effect and as such should be controlled with javascript.

 

Browsers still open windows ifyou use target="_blank" BUT that is not valid markup in strict xhtml or xhtml 1.1

pure xhtml is most certainly the way to go - strict and 1.1 are standards compliant technologies - as such they DO NOT have valid markup for style OR document effects. Those are for css and javascript.

 

The beauty of it all is that what you shuld do is sit down and make a site that works with nothing - no javascript no css nothing.  You then have a site that just works (in ANY client potentially).  Then you style the site - make it look good and provde styles for different media (mobile phones, printers etc etc).

 

THEN you add all the things to increase the users experience - flash, javascript.

 

OPening a new window might seem like something you shoudl be able to do regardless - but many find it annoying, visually impaired are not likely to know they are in a new window and may not then know how to get back to the content they wanted....

 

Stick with the standards and you will make better sites...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.