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
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...

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.