[advanced search]
Results from the most recent live auction are here.
22 members in the live chat room. Join Chat!
Register Rules & FAQ NP$ Store Active Threads Mark Forums Read
Go Back   NamePros.Com > Design and Development > Programming
User Name
Password

Old 03-05-2008, 02:06 PM   · #1
gridsix
New Member
 
Trader Rating: (0)
Join Date: Mar 2008
Posts: 15
NP$: 0.00 (Donate)
gridsix is an unknown quantity at this point
Forcing external links to open in a new window

Anyone know of a way to make all external links on a given site open in a new window? Maybe via css, or the htaccess file?

Thanks much!


Please register or log-in into NamePros to hide ads
__________________
zMogo WebMaster Community
gridsix is offline   Reply With Quote
Old 03-05-2008, 02:46 PM   · #2
Daniel
Danltn.com
 
Daniel's Avatar
 
Name: Daniel Neville
Location: Danltn.com / Nottingham, UK
Trader Rating: (65)
Join Date: May 2007
Posts: 1,185
NP$: 0.56 (Donate)
Daniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond repute
Ethan Allen Fund Ethan Allen Fund
htaccess has no effect over what window links open in.

The best bet would be use PHP's output buffering to 'catch' the output, then find out-going links and rewrite them as such to add the extra tag needed.

I would write some code, but I'm kinda tired.

Dan
Daniel is offline   Reply With Quote
Old 03-05-2008, 03:34 PM   · #3
gridsix
New Member
 
Trader Rating: (0)
Join Date: Mar 2008
Posts: 15
NP$: 0.00 (Donate)
gridsix is an unknown quantity at this point
would there be a lot of code? how would i implement it site-wide?

Thanks...
__________________
zMogo WebMaster Community
gridsix is offline   Reply With Quote
Old 03-05-2008, 07:45 PM   · #4
xrvel
xrvel is cruel :-)
 
xrvel's Avatar
 
Name: Kurniawan
Location: Indonesia
Trader Rating: (39)
Join Date: Nov 2007
Posts: 1,094
NP$: 256.03 (Donate)
xrvel has much to be proud ofxrvel has much to be proud ofxrvel has much to be proud ofxrvel has much to be proud ofxrvel has much to be proud ofxrvel has much to be proud ofxrvel has much to be proud ofxrvel has much to be proud of
You can use the JavaScript, which is attached below
It will convert all external links, and add "target=_blank" for each external link, automatically on body "onload".

Kurniawan.
Attached Files
File Type: txt html.txt (1.2 KB, 10 views)

Last edited by xrvel : 03-07-2008 at 08:14 PM.
xrvel is online now   Reply With Quote
Old 03-07-2008, 01:04 PM   · #5
Zubair1
NamePros Regular
 
Trader Rating: (11)
Join Date: Mar 2005
Posts: 862
NP$: 81.00 (Donate)
Zubair1 is just really niceZubair1 is just really niceZubair1 is just really niceZubair1 is just really nice
AIDS/HIV
If you don't have a problem, it can also be done with PHP by making a function
let me know if you want that and i'll have it done for you

but do note you will have to add links using that function like this for example if you want to add a new link pointing to msn.com you would have to do it this way.

Code:
<?php add_link("http://www.msn.com/"); ?>


__________________
Live Support : Zubair11 [at] hotmail.com
Free SEO Directory! || Free Games and Songs || eBloggy.net
Zubair.info || Mixcat Interactive
Zubair1 is offline   Reply With Quote
Old 03-07-2008, 08:09 PM   · #6
monaco
NamePros Regular
 
monaco's Avatar
 
Location: Tucson, AZ
Trader Rating: (0)
Join Date: Jul 2005
Posts: 649
NP$: 22.50 (Donate)
monaco is on a distinguished road
Just edit your external links to use target=_blank as an attribute to the a tag. If the links are put there by you, do it manually, if they're being put there by a script, edit the script.
__________________
My Website | My Blog
monaco is offline   Reply With Quote
Closed Thread

NamePros is a revenue sharing forum.

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


Site Sponsors
http://www.mobisitetrader.com/ Traffic Down Under Traffic Down Under
Advertise your business at NamePros
All times are GMT -7. The time now is 10:40 PM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0