Reply
target="_blank"
Old 12-20-2007, 04:41 PM target="_blank"
Colin's Avatar
Average Talker

Posts: 23
Name: Colin Smiley
Hey...I want to know if there is a way to achieve the effect of the target="_blank" tag in xhtml 1.0 strict? I would rather not use javascript so please let me know if there is another option...Thanks...
Colin is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 12-20-2007, 08:56 PM Re: target="_blank"
coolkbk585's Avatar
Be good this Christmas!

Latest Blog Post:
KBlog has been deativated
Posts: 642
Name: Kyle
Location: Ada, MI
Does target="_blank" not validate? I think it should...it's not a depreciated code...
__________________
<?php if($Adsense_Revenue > 0): define('HAPPINES','100%'); else: define('HAPPINESS', '0%') endif; ?>
coolkbk585 is offline
Reply With Quote
View Public Profile Visit coolkbk585's homepage!
 
Old 12-20-2007, 09:05 PM Re: target="_blank"
joder's Avatar
Flipotron

Posts: 6,443
Name: James
Location: In the ocean.
http://www.w3.org/MarkUp/2004/xhtml-faq#target
Quote:
Why was the target attribute removed from XHTML 1.1?

It wasn't. XHTML 1.0 comes in three versions: strict, transitional, and frameset. All three of these were deliberately kept as close as possible to HTML 4.01 as XML would allow. XHTML 1.1 is an updated version of XHTML 1.0 strict, and no version of HTML strict has ever included the target attribute. The other two versions, transitional and frameset, were not updated, because there was nothing to update. If you want to use the target attribute, use XHTML 1.0 transitional.


target is not a part of any strict specification. You need to use javascript to achieve this.
joder is offline
Reply With Quote
View Public Profile
 
Old 12-20-2007, 10:46 PM Re: target="_blank"
LadynRed's Avatar
Super Moderator

Posts: 6,553
Location: Tennessee
Joder is exactly right, it is not valid for a Strict doctype. The question becomes - why are you opening up a new window anyway ?
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!
"Using or working with IE is like having to wear a 1970's polyester suit with pantyhose and a girdle, to work everyday"
Carolina Corvette Club
LadynRed is offline
Reply With Quote
View Public Profile
 
Old 12-21-2007, 01:19 AM Re: target="_blank"
tripy's Avatar
Fetchez la vache!

Posts: 2,055
Name: Thierry
Location: In the void
2 solutions:
Extend the doctype to support it:
http://blog.codexpress.cn/xhtml/usin...tml-10-strict/

Add a bit of javascript that will emulate it through DOM manipulation:
http://www.sitepoint.com/article/sta...ompliant-world (page 3 for the script)

Although I would recommand you the 2nd solution. Put a rel="external" on your links, and have the sitepoint javascript ran on pageload to alter the dom to opne those links in a new window.
__________________
Listen to the ducky: "This is awesome!!!"

tripy is offline
Reply With Quote
View Public Profile
 
Old 12-21-2007, 02:14 PM Re: target="_blank"
Truly's Avatar
Extreme Talker

Posts: 214
Thats terrible. Why would they take that feature away from us? And realistically does it matter if you conform to strict standards unless you are targeting cellphones or other handheld/wireless devices with limited processing. I know you experts are cringing at my disregard for standards, and maybe I am killing the internet, but so what? :P

It seems almost as if they are forcing developers to learn JS. Im still in the process of mastering PHP, I cant take the time to learn JS now too. Is it really that bad if he just chooses transitional so he doesnt have to use JS?
Truly is offline
Reply With Quote
View Public Profile
 
Old 12-21-2007, 02:24 PM Re: target="_blank"
chrishirst's Avatar
Super Moderator

Posts: 13,580
Location: Blackpool. UK
Nobody has "taken the feature away"

It was never really there in ANY DTD other than a frameset DTD

The target attribute value has no meaning intrinsically unless there are named frames to send the page content to.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 12-21-2007, 02:25 PM Re: target="_blank"
joder's Avatar
Flipotron

Posts: 6,443
Name: James
Location: In the ocean.
Quote:
Originally Posted by Truly View Post
Thats terrible. Why would they take that feature away from us? And realistically does it matter if you conform to strict standards unless you are targeting cellphones or other handheld/wireless devices with limited processing. I know you experts are cringing at my disregard for standards, and maybe I am killing the internet, but so what? :P

It seems almost as if they are forcing developers to learn JS. Im still in the process of mastering PHP, I cant take the time to learn JS now too. Is it really that bad if he just chooses transitional so he doesnt have to use JS?
No one is forcing you to use the Strict specification. Use Transitional. The browsers support transitional and it's not going away anytime soon.

Personally, I think pop-up windows are only good in rare instances such as to assist in finding information to put in a form (using javascript, not target). Most other times, I just close the window and if there are too many, remember never to return to that site again. Hopefully, pop-up blockers will keep in step.
joder is offline
Reply With Quote
View Public Profile
 
Old 12-21-2007, 02:32 PM Re: target="_blank"
johneva's Avatar
Super Talker

Latest Blog Post:
Mastretta MXT Coupe
Posts: 139
Location: Stafford, England
The idea is it should not be the webmaster who makes the sites choice on wether a new window is opened but the users choice, nothing I hate more than being on a site which keeps opening new windows for me. If I want it in a new window or a new tab I am more than caperble of making it do it myself I dont need the websites coding to do it for me.

Everybody who decided they where going to instead start using Javascript to make things open in a new window are all just cheating the idea of giving window opening control back to the user instead of the webmaster.

Last edited by johneva : 12-21-2007 at 02:34 PM.
johneva is offline
Reply With Quote
View Public Profile Visit johneva's homepage!
 
Old 12-21-2007, 02:39 PM Re: target="_blank"
Truly's Avatar
Extreme Talker

Posts: 214
I agree with letting the user decide BUT what about on a webforum like webmaster-talk? You can have users click a link and then be taken away from the forum, often times the user is just looking at the site for reference to whatever they are talking about.

Now maybe this site is a bad example because we all know the shortcuts to opening new tabs/windows quickly but alot of people dont.

Quote:
No one is forcing you to use the Strict specification. Use Transitional. The browsers support transitional and it's not going away anytime soon.
Then why use strict ever if its just going to limit functionality? Just to speed up load times and to ensure 99.9% compatibility?
Truly is offline
Reply With Quote
View Public Profile
 
Old 12-21-2007, 02:45 PM Re: target="_blank"
LadynRed's Avatar
Super Moderator

Posts: 6,553
Location: Tennessee
Another JS method for opening new windows (if you must):
http://www.456bereastreet.com/archiv...pt_version_12/

Then we have the reasons why it's a BAD idea to do it. The Scourge of New Windows
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!
"Using or working with IE is like having to wear a 1970's polyester suit with pantyhose and a girdle, to work everyday"
Carolina Corvette Club
LadynRed is offline
Reply With Quote
View Public Profile
 
Old 12-21-2007, 03:01 PM Re: target="_blank"
johneva's Avatar
Super Talker

Latest Blog Post:
Mastretta MXT Coupe
Posts: 139
Location: Stafford, England
Quote:
Originally Posted by Truly View Post
I agree with letting the user decide BUT what about on a webforum like webmaster-talk? You can have users click a link and then be taken away from the forum, often times the user is just looking at the site for reference to whatever they are talking about.

Now maybe this site is a bad example because we all know the shortcuts to opening new tabs/windows quickly but alot of people dont.


Then why use strict ever if its just going to limit functionality? Just to speed up load times and to ensure 99.9% compatibility?
Well I dont even need to put a reply cosmost of it has been answred for me by the article posted above, take a good read.

As for why use strict there are many reasons I wont get into them and it is easy to find the answer if you look, but think of it this way times change and although its only in strict ATM and you can get away with it in transitional do you think it will always only be like this?

Same old thing with computers you get people who just dont want to learn new stuff they like the old way but sooner or later the old way carnt be done anymore and they have to laern the new way.

Last edited by johneva : 12-21-2007 at 03:03 PM.
johneva is offline
Reply With Quote
View Public Profile Visit johneva's homepage!
 
Old 12-21-2007, 10:48 PM Re: target="_blank"
Truly's Avatar
Extreme Talker

Posts: 214
/me has been happily put in his place

Thanks for the insight
Truly is offline
Reply With Quote
View Public Profile
 
Old 12-21-2007, 11:28 PM Re: target="_blank"
Colin's Avatar
Average Talker

Posts: 23
Name: Colin Smiley
Well I am doing it for like sites I link to, they open in a new window or new tab...
Colin is offline
Reply With Quote
View Public Profile
 
Old 12-22-2007, 12:01 PM Re: target="_blank"
LadynRed's Avatar
Super Moderator

Posts: 6,553
Location: Tennessee
Quote:
Well I am doing it for like sites I link to, they open in a new window or new tab...
Why ? Do you think you're keeping people on your site ? That's not a good reason. Usability studies show that people DO know how to use their BACK button and they do so easily .. and liberally. That old 'keep 'em on your site' is just that .. OLD - it's bad for accessibility and usability. Don't try to control your visitors, they don't like it and may not come back.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!
"Using or working with IE is like having to wear a 1970's polyester suit with pantyhose and a girdle, to work everyday"
Carolina Corvette Club
LadynRed is offline
Reply With Quote
View Public Profile
 
Old 12-23-2007, 06:01 AM Re: target="_blank"
Experienced Talker

Posts: 30
lol, opening linkpartners in a new tab is normal I guess..
Look: if someone of you gave a link to his website here, and I click it, I would like it to open in a new tab and not in the same window...
klaroen is offline
Reply With Quote
View Public Profile
 
Old 12-23-2007, 12:22 PM Re: target="_blank"
johneva's Avatar
Super Talker

Latest Blog Post:
Mastretta MXT Coupe
Posts: 139
Location: Stafford, England
Well not really no if I am looking at links to leave your site then why would I want it in a new window? If I do decide I want to go back to your site then all I have to do is press the back button, where as if I open a new window mooch around and want to go back, I would have closed the old window and now lost my way back to your site.

I am one of these who dont like 1000 windows open on my computer it something opens in a new window I close the old one, which then means as I already said if I do decide to go back to your site you have actually made it harder for me by opening in a new window cos I carnt just press the back button.

There is no excuse for it all links should always open in the same window thats why target="_blank" is not classed as correct coding.This is another one of them topics just not even worth going over though really its upto you wether you want to stick with the standards or not.

Its always the same whenever it comes to doing anything the proper or new way people disagree and say but I dont like it, just like the tables and divs argument, just like the argument of wether standards are worth sticking to or not. Thing is its upto you what you want to do we were simpley explaining why its is the way it is, personally I like the idea but then others dont understand why, thats cool were all different and have different opinions.

Last edited by johneva : 12-23-2007 at 12:23 PM.
johneva is offline
Reply With Quote
View Public Profile Visit johneva's homepage!
 
Old 12-23-2007, 03:13 PM Re: target="_blank"
joder's Avatar
Flipotron

Posts: 6,443
Name: James
Location: In the ocean.
Everyone has a right to their opinion. I happen to agree with Strict not using target. If you want to use Strict and target, your site will not be compliant. You will have to use javascript to open a n