Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XHTML compliant "new browser" window. 1

Status
Not open for further replies.

irbk

MIS
Oct 20, 2004
578
US
As the W3C found it fitting to deprecate the target="_blank" code
(example)
Code:
<a href="site.html" target="_blank">My site</a>
to open up a new browser window, how have you been creating a "new browser window"? I've been using some javascript
(example)
Code:
<a href="javascript:" onclick="open('[URL unfurl="true"]http://www.site.html','','')">My[/URL] site</a>
That works fine, as long as javascript isn't turned off. If it is turned off, the link goes no where.

How have you managed to accomplish it while maintaining XHTML compliance?

Thanks in advance.
 
You can use:

Code:
<a href="site.html" onclick="this.target = '_blank';">My site</a>

as a partial compromise (opens in same window for no JS, new window if JS is present).

However, you could always not do either, and let the user decide where they would like to open links. This is the better option, IMHO.

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
When you say you could always do neither and have the user decide. What do you mean?
Thanks.
 
the standards are if a use wants a link to open in a new browser they right click the link and choose 'open in new window / tab'

alternatively, use a doc-type that allows the target attribute!

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
opps -> the standards are if a USER

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
In my experience, users are by definition ignorant, thus incapiable of understanding the idea of a right click open in new window command. Often, I need to put a "back" link on the page because the users arn't bright enough to use the back button of the browser.
I like your inital idea the best. Covers all the bases. Works if javascript is disabled (though navigates the user away from my site, which is what I want to avoid) however, if javascript is enabled, it works perfectly and opens a new browser window.
Thanks.
 
In my experience, users are by definition ignorant

All the more reason not to add to their mental turmoil by opening new windows then.

<honk>*:O)</honk>

Tyres: Mine's a pint of the black stuff.
Mike: You can't drink a pint of Bovril.
 
Good point Foamcow. Still, I don't want them to leave my site either. Best of both worlds to provide them with information from another source while not navigating them away from my site (as they are users and may not be able to figure out how to use the "back" button on the browser to get back to my site) is the new window option.

I appreciate all the opinions!
 
you do leave the posibility that they close your site's window thinking they can click 'back' from the new window, but then find they can't!

the one thing I've found you can never do is second guess how a user will behave, we all surf differently!

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
Hi

Hmm... Indeed, that can be interpreted like that too. But I think irbk want to say "I don't want them to leave my site because the frustration of being unable to use the browser's navigation buttons".

Feherke.
 
Ok, let me clarify. I'm pointing them to another site as a source for additional information. As people who are looking for additional informating tend to do, when sent to another site for additional information, they click through to another site providing yet more information, and down the rabbit hole they go. 10 minutes and 50 website's later, I don't want them to have to try and navigate back to the source site. I want them to get the additional information the other site offers, and even surf other information on the site, and have it still be easy for them to return to the source.
There is no "perfect solution". Some users are going to be bothered by having a new window opened. Other users are going to be bothered by trying to navigate back to the source site(not to mention that, if during a trip down the rabbit hole, they run across a site that breaks the back button, they won't be able to navigate back to the source site easily).
So no matter what I do, some one is going to be unhappy. I feel that my primary consern is providing the end user with the information provided on my site. As I can not guarentee that the back button will not be "broken" off of a link on the page of additional information, I feel the lesser of two evils is to open a new browser window.
 
Have you surveyed your users? What is your target market? Are they IT savvy? Are they Ma + Pa Jones with an old 486?

I think most web developers don't necessarily develop for their intended target audience.

If yours are IT savvy (e.g. it's a design site, a script site, or other site than assumes the viewer has an IQ above that of an earthworm), then don't bother with this at all - let the them decide (I always open links in a new tab).

If it's a knitting pattern site aimed at 60 year old grannies, then you probably do want to do this.

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
As I can not guarentee that the back button will not be "broken" off of a link on the page of additional information

This is a very valid point IMO , a lot of sites employ this devious practice of breaking the back button, which is why Google AdWords will not alow any sites to advertise that do this.

It's all very well writing to the standards , if everyone was to do the same, but if you open a link in the same browser that goes to a site that 'breaks' the back button, then that's not really on is it.

maybe you need to vet all links on your site and if any break the back button, remove them, or politely ask them to fix it, depending on your relationship with the 3rd party website, will depend on whether you get a favourable answer.

Any site the breaks the back button , I never visit again, including the site that sent me there, which is why you must think carefully before offering links to sites that employ these devious non-standards practices.




"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
It's an informational site only. Most likely, the viewers of the site will be scientists, and old school scientists at that. Like the fact they are actually looking at the information on-line is down right amazing. If the scientists I've dealt with are any indication, the people viewing the site are not IT savy.
 
but scientists are not exactly the usual 'surfer' either, they are probably smarter then you and I put together!

I'd find it odd if they could find a cure for cancer, split the atom or create a wormhole , but aren't capable of using a web browser?

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top