Newbie question - open new window in XHTML 1.1 document

G

Gérard Talbot

Sam wrote :
Hi All,

I am trying to open a new window from a XHTML 1.1 document.

Do you really need to have an XHTML 1.1 document? What's wrong with HTML
4.01 strict?

The following
code works but I am not happy with having to put the current page name as a
literal. Change the page filename, change all literal references to it.

<a href="javascript:location='current page';
window.open('http://newurl')">Link</a>

General rule is to avoid resorting to opening new windows. But, if after
careful assessment, you really think it's best, then follow usability
guidelines (Nielsen, WCAG, WAI) here:

DOM:window.open
Usability issues:
http://developer.mozilla.org/en/docs/DOM:window.open#Usability_issues

and also use the examples and best recommendable practices as provided
in that document.

Never use this form of code for links:
<a href="javascript:window.open(...)" ...>
http://developer.mozilla.org/en/doc...D.22javascript:window.open.28....29.22_....3E


But again, I want to stress that the safe, sound alternative of not
opening new windows is almost always better.

Gérard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,126
Latest member
FastBurnketoIngredients
Top