View Full Version : Open outside links in new window/tab?

10-30-2009, 09:46 PM
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^^

10-30-2009, 10:11 PM
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.