Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-30-2009, 08:46 PM   PM User | #1
OceanLady
New to the CF scene

 
Join Date: Oct 2009
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
OceanLady is an unknown quantity at this point
Question Open outside links in new window/tab?

I have a blogger blog (http://www.thepinkpacifier.com) and I'm wondering if there's any way I can modify the template coding to make all the links leading off of the site automatically open in another window so that I don't have to put target=_blank in the link code every time.

I don't want the links to my other blog posts and such to open in new windows, but I link to various baby products fairly often and I don't want to lead people away from my site.

Thanks in advance^^
OceanLady is offline   Reply With Quote
Old 10-30-2009, 09:11 PM   PM User | #2
Rowsdower!
Senior Coder

 
Rowsdower!'s Avatar
 
Join Date: Oct 2008
Location: Some say it's everything.
Posts: 2,015
Thanks: 5
Thanked 395 Times in 388 Posts
Rowsdower! has a spectacular aura aboutRowsdower! has a spectacular aura aboutRowsdower! has a spectacular aura about
You can use javascript for this. You would need to test the URL for every link in the page to see if it is external and then, if it is, dynamically add the attribute of target="_blank" to the <a> tag.

You could probably work out some PHP for this too, but that would be a pain.
__________________
The object of opening the mind, as of opening the mouth, is to shut it again on something solid. –G.K. Chesterton
See Mediocrity in its Infancy
It's usually a good idea to start out with this at the VERY TOP of your CSS: * {border:0;margin:0;padding:0;}
Seek and you shall find... basically:
validate your markup | view your page cross-browser/cross-platform | free web tutorials | free hosting
Rowsdower! is offline   Reply With Quote
Reply

Bookmarks

Tags
link, open in new tab, open in new window, outside link

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 03:32 PM.


Advertisement
Log in to turn off these ads.