There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
access audio avg avg 8 bios blue screen boot bsod computer connection cpu crash css dell desktop driver drivers dvd email error excel explorer firefox firefox 3 freeze gimp graphics hard drive hardware hijackthis hjt install internet internet explorer itunes keyboard laptop macro malware missing monitor network networking outlook outlook 2003 outlook 2007 outlook express password popups problem problems router seo server slow sound sp3 spyware trojan usb video virtumonde virus vista vundo windows windows vista windows xp winxp wireless
Web Design & Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Internet & Networking > Web Design & Development >
Opening link in new window.


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

 
Thread Tools
deepdiver01's Avatar
Senior Member with 728 posts.
 
Join Date: Dec 2004
Location: Cairns, Australia
Experience: Intermediate
27-Apr-2007, 06:37 PM #1
Opening link in new window.
Hi all.

Just a quick on.

I would like the links on a page to open in a new window.

Is there a bit of code I can add to the page that will allow this for all the links on that page without having to add target="_blank" to each anchor?

Thanks.

Deep.
__________________
Six mumfs ago I coodnt spel injineer. Now I are wun.

Domain Names, Web Hosting
Free Online Games | Free Flash Games
Australian Domain Names
Motor Finance Wizard Information Base
harmor's Avatar
Senior Member with 117 posts.
 
Join Date: Mar 2007
Experience: Intermediate
27-Apr-2007, 08:59 PM #2
<a href="http://xenweb.net/forums" target="_blank">Free Hosting</a>

Last edited by harmor : 28-Apr-2007 02:16 PM.
deepdiver01's Avatar
Senior Member with 728 posts.
 
Join Date: Dec 2004
Location: Cairns, Australia
Experience: Intermediate
27-Apr-2007, 09:29 PM #3
Cheers for that harmour. Know that one.

I was wondering if the was a bit of code that could be put in the page that did away with having to add target="_blank" to every <a> tag. Got a page with about 150 links and it and they will change from time to time.

Just trying to save a bit of time.
__________________
Six mumfs ago I coodnt spel injineer. Now I are wun.

Domain Names, Web Hosting
Free Online Games | Free Flash Games
Australian Domain Names
Motor Finance Wizard Information Base
namenotfound's Avatar
Computer Specs
Distinguished Member with 2,049 posts.
 
Join Date: Apr 2005
Location: New York
Experience: I know what I know, I am what I am.
27-Apr-2007, 10:50 PM #4
Quote:
Originally Posted by harmor
<a href="http://xenweb.net/forums" target="_blank">Free Hosting</a>
He said "without having to add target="_blank" to each anchor" lol
harmor's Avatar
Senior Member with 117 posts.
 
Join Date: Mar 2007
Experience: Intermediate
27-Apr-2007, 11:12 PM #5
Quote:
Originally Posted by namenotfound
He said "without having to add target="_blank" to each anchor" lol
I don't remember seeing that in his post.
The only way I can think of is with javascript.
namenotfound's Avatar
Computer Specs
Distinguished Member with 2,049 posts.
 
Join Date: Apr 2005
Location: New York
Experience: I know what I know, I am what I am.
28-Apr-2007, 07:20 AM #6
Quote:
Originally Posted by harmor
I don't remember seeing that in his post.
The only way I can think of is with javascript.
lol

jaymanson's Avatar
Computer Specs
Senior Member with 213 posts.
 
Join Date: Mar 2007
Location: Christchurch, New Zealand
Experience: Advanced Design/HTML/CSS - Intermediate PHP
09-May-2007, 10:04 PM #7
Hey mate,

You may have solved this yourself by now, but if not there is a really easy way to do this.

In the <head> of your page, you can use the little known about <base> tag. Now although this is normally used to provide a base URL for links, you can also use it to specify the target. The code you'd want to stick in the <head> would be:

<base target="_blank">

Easy! No hassles, no changing each individual link, no JS

Jay
deepdiver01's Avatar
Senior Member with 728 posts.
 
Join Date: Dec 2004
Location: Cairns, Australia
Experience: Intermediate
10-May-2007, 03:13 AM #8
Hey jaymason.

Thank you, oh thank you.

I was putting it in all the anchor links, using a bit of a code template. Not so nasty but still time consuming and giving too much code in the html.

Didi not realise you could use <base> that way.

Thanks again.

Deep
__________________
Six mumfs ago I coodnt spel injineer. Now I are wun.

Domain Names, Web Hosting
Free Online Games | Free Flash Games
Australian Domain Names
Motor Finance Wizard Information Base
jaymanson's Avatar
Computer Specs
Senior Member with 213 posts.
 
Join Date: Mar 2007
Location: Christchurch, New Zealand
Experience: Advanced Design/HTML/CSS - Intermediate PHP
10-May-2007, 03:22 AM #9
no worries bro
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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 Off
Refbacks are Off

You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 12:59 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.