iEntry 10th Anniversary Forum Rules Search
WebProWorld
Register FAQ Calendar Mark Forums Read
Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Share Thread: & Tags

Share Thread:

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-22-2009, 04:38 PM
WebProWorld Member
 
Join Date: Oct 2003
Location: Woodbine Georgia
Posts: 58
gene02 RepRank 0
Default HTML Basics

Hi I will start with if this is in the wrong forum please move it to the correct one. I have been away from the programming side of this business for a while and am getting back into it WPW has changed a lot since I have been out of it you don't even have a HTML forum any more that I found anyway.

My question is this when creating a link such as
<a href="link.html">Text info</a>

Does using the blank tag still work only in certain browsers any more or is completely obsolete and if obsolete what is the work around.

<a href="link.html" target="_blank">Text info</a>

In the past I would use the blank tag to get the link count but by sending them to a new widow I would keep the fewer on my site as well. With popup blocker and tabs I am not sure about today’s environment.

And you don’t know how old this makes me feel asking a simple question like this it’s only been a few years. LOL

Thanks
__________________
Thanks For Your Time Gene Crain
http://www.justwebsitedesign.com
Reply With Quote
  #2 (permalink)  
Old 07-22-2009, 05:14 PM
wige's Avatar
Moderator
WebProWorld Moderator
 
Join Date: Jun 2006
Location: United States
Posts: 2,651
wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9
Default Re: HTML Basics

The target attribute has been officially deprecated, and while it is still supported in quirks (HTML) mode, it won't be supported if your page has an XHTML tag.

The "new" way to open a new window is to use Javascript:
Code:
<a href="link.html" onclick="window.open('link.html');">Text info</a>
__________________
The best way to learn anything, is to question everything.
Reply With Quote
  #3 (permalink)  
Old 07-22-2009, 05:30 PM
WebProWorld Member
 
Join Date: Jun 2009
Location: Bellville
Posts: 56
Modified RepRank 2
Default Re: HTML Basics

Is it me or does it seem the new way isn't an improvement on the the old target="_blank"?
Reply With Quote
  #4 (permalink)  
Old 07-22-2009, 05:35 PM
Uncle Dog's Avatar
WebProWorld Pro
 
Join Date: Apr 2008
Location: Scotland
Posts: 266
Uncle Dog RepRank 5Uncle Dog RepRank 5Uncle Dog RepRank 5Uncle Dog RepRank 5Uncle Dog RepRank 5Uncle Dog RepRank 5
Default Re: HTML Basics

Definitely NOT.
Reply With Quote
  #5 (permalink)  
Old 07-22-2009, 05:56 PM
wige's Avatar
Moderator
WebProWorld Moderator
 
Join Date: Jun 2006
Location: United States
Posts: 2,651
wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9
Default Re: HTML Basics

Never said it was better...
__________________
The best way to learn anything, is to question everything.
Reply With Quote
  #6 (permalink)  
Old 07-22-2009, 06:08 PM
WebProWorld Member
 
Join Date: Oct 2003
Location: Woodbine Georgia
Posts: 58
gene02 RepRank 0
Default Re: HTML Basics

Thanks for the help. WPW crew has alway been good for helping out.
Not a big change.
__________________
Thanks For Your Time Gene Crain
http://www.justwebsitedesign.com
Reply With Quote
  #7 (permalink)  
Old 07-23-2009, 05:15 AM
WebProWorld Member
 
Join Date: Jun 2009
Location: Bellville
Posts: 56
Modified RepRank 2
Default Re: HTML Basics

Quote:
Originally Posted by wige View Post
Never said it was better...
Not saying you did mate. Just commenting on the sometimes backwardness of progress.

My humblest apologies if it sounded like I was criticizing you.

What I meant was that when something gets deprecated you'd expect it to be replaced by something better.
Reply With Quote
  #8 (permalink)  
Old 07-23-2009, 11:07 AM
wige's Avatar
Moderator
WebProWorld Moderator
 
Join Date: Jun 2006
Location: United States
Posts: 2,651
wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9
Default Re: HTML Basics

True. Really, the intent of the target attribute was for frames, when frames were removed from the spec target basically went with it. Of course, W3C reasoned this away by saying you should leave it as a user option whether or not to open the page in a new window.
__________________
The best way to learn anything, is to question everything.
Reply With Quote
  #9 (permalink)  
Old 07-23-2009, 05:14 PM
WebProWorld Member
 
Join Date: Jan 2009
Posts: 26
DBLL RepRank 0
Default Re: HTML Basics

Using the target attribute is generally considered a bad practice, because users can right-click the link, and chose open in a new window, if thats what they want. And i can honestly say that i agree its better to do things this way.

Using JavaScript is better, because you can do all sorts of stuff, aside from just opening the link in a new window. You can also call a function, which tracks the number of times the link was clicked, for example.

Those who still use the target attribute, are really just going to annoy a large chunk of their visitors.
__________________
The Blood of the Lamb is my Breakfast.
Reply With Quote
  #10 (permalink)  
Old 07-23-2009, 08:05 PM
DaveSawers's Avatar
WebProWorld Veteran
 
Join Date: Dec 2006
Location: Calgary, Alberta, Canada
Posts: 492
DaveSawers RepRank 3DaveSawers RepRank 3
Default Re: HTML Basics

Quote:
Originally Posted by DBLL View Post
Using JavaScript is better, because ...
Unless the user has Javascript disabled of course.
__________________
Dynamic Software Development
www.activeminds.ca
Reply With Quote
  #11 (permalink)  
Old 07-23-2009, 08:30 PM
Uncle Dog's Avatar
WebProWorld Pro
 
Join Date: Apr 2008
Location: Scotland
Posts: 266
Uncle Dog RepRank 5Uncle Dog RepRank 5Uncle Dog RepRank 5Uncle Dog RepRank 5Uncle Dog RepRank 5Uncle Dog RepRank 5
Default Re: HTML Basics

... we're getting to the stage where it seems to be frowned upon if you design/sequence/organise/prettify/structure/define the way you'd like to present your information over the web. I think it's the xml obsession, content with no markup that becomes markup with no content, rearing its ugly head again.

target="_blank" is considered bad practice because it is trying to control the sequence and focus whilst a user accesses information. Using this same criteria, films (movies) ought to be distributed as a collection of random scenes. I'd like to see the end first, green and yellow's nice, very loud music please... and make all the characters big

Last edited by Uncle Dog; 07-23-2009 at 08:33 PM.
Reply With Quote
  #12 (permalink)  
Old 07-23-2009, 11:44 PM
WebProWorld Member
 
Join Date: Jan 2009
Posts: 26
DBLL RepRank 0
Default Re: HTML Basics

Quote:
Originally Posted by DaveSawers View Post
Unless the user has Javascript disabled of course.
Thats their choice, not our problem. Luckily few users are stupid enough to do something as drastic as that, because then they wouldn't be able to use facebook, youtube, or even their favorite web-mail client optimally.


Why would anyone want to use the target attribute anyway? What practical purpose dose it serve? Other then annoy users?

I used it my self some years back, but that was before i started to think about the annoyances it creates for users. Browsers don't indicate when the target attribute is used, you will have to do that through a custom user-defined stylesheet, and fooling with attribute selectors. Browsers also dont have a "open in same window" link, which can be quite annoying when you encounter sites that uses the target attribute.


Some designers also abuse the scripted versions, simply for the sake of customizing the look and feel of the browser. Without ever thinking about the features that they are hampering.

Its generally considered good design practice, to provide alternatives to those features if you chose to remove them.
__________________
The Blood of the Lamb is my Breakfast.
Reply With Quote
  #13 (permalink)  
Old 07-24-2009, 12:27 AM
DaveSawers's Avatar
WebProWorld Veteran
 
Join Date: Dec 2006
Location: Calgary, Alberta, Canada
Posts: 492
DaveSawers RepRank 3DaveSawers RepRank 3
Default Re: HTML Basics

Quote:
Originally Posted by DBLL View Post
Thats their choice, not our problem. Luckily few users are stupid enough to do something as drastic as that...
Hmm. Interesting reaction. I was always taught that you built web sites for the benefit of the users, not to satisfy ones own prejudices.

Many mobile devices have Javascript turned off by default and many of those 'stupid users' (as you like to refer to them) probably don't realise that's the case. They just see a web site that doesn't work and go elsewhere.
__________________
Dynamic Software Development
www.activeminds.ca
Reply With Quote
  #14 (permalink)  
Old 07-24-2009, 12:38 AM
wige's Avatar
Moderator
WebProWorld Moderator
 
Join Date: Jun 2006
Location: United States
Posts: 2,651
wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9
Default Re: HTML Basics

But, with this method if the client has Javascript disabled, execution will fall through safely - the link still works, it is just up to the user if they want to open the link in a new window/tab. In fact, it should be safer on mobile devices, which may not properly handle target.
__________________
The best way to learn anything, is to question everything.
Reply With Quote
  #15 (permalink)  
Old 07-24-2009, 09:36 AM
DaveSawers's Avatar
WebProWorld Veteran
 
Join Date: Dec 2006
Location: Calgary, Alberta, Canada
Posts: 492
DaveSawers RepRank 3DaveSawers RepRank 3
Default Re: HTML Basics

Wige, I understand what you are saying here. I didn't look closely enough at your original example up in post #2. instead I assumed that the link itself would be to Javascript which therefore wouldn't have worked if Javascript is disabled.

Your example certainly does work if Javascript is disabled, but when Javascript is enabled the effect is not what you might expect.

In both Firefox 3 and IE8 and presumably other browsers too, the Javascript opens the link in a new window and the href opens the link in the current window so you now have two windows showing the same content and the original page has disappeared. I guess you could fix this by getting the Javascript to go back to the original window and execute a 'back' command then switch back to the new window but this seems extremely clumsy and messes up the users browsing history.

I can't find any evidence for your claim that this is the 'new way to open a new window'.
__________________
Dynamic Software Development
www.activeminds.ca
Reply With Quote
  #16 (permalink)  
Old 07-24-2009, 11:10 AM
wige's Avatar
Moderator
WebProWorld Moderator
 
Join Date: Jun 2006
Location: United States
Posts: 2,651
wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9wige RepRank 9
Default Re: HTML Basics

Yeah, I was typing fast and screwed it up. The correct code is as follows:

<a href="link.html" onclick="window.open(this);return false;">Text info</a>

This code will work such that the window will open to the page specified in the href element - there is no need to even change the onclick if, for example, you someday change the link destination. Being that this is a very old, core piece of Javascript code, it should work as is in every browser that supports Javascript. I have tested it in IE6, IE7, IE8, Chrome, Opera 9, Opera 10, Firefox2, Firefox3 and Safari with Javascript enabled and disabled with no issues.

Also, I wasn't claiming this was new in any way (hence the quotes) just that this is the current alternative, which is acceptable for documents using the XHTML1.0 Strict doctype.
__________________
The best way to learn anything, is to question everything.
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
PPC Basics rfrazee SEO 101 1 06-23-2008 04:08 PM
Just the basics, please! MikeSzyszka Flash Discussion Forum 2 03-09-2005 01:38 PM
SEO Basics chrison600 Search Engine Optimization Forum 2 12-21-2004 04:35 PM
basics mikeyinhk Google Discussion Forum 1 09-17-2004 12:01 PM


All times are GMT -4. The time now is 12:04 AM.



Search Engine Optimization by vBSEO 3.3.0