 |
Results from the most recent live auction are here.
22 members in the live chat room. Join Chat!
| |
03-05-2008, 02:06 PM
|
· #1 | | New Member | 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! |
| |
03-05-2008, 02:46 PM
|
· #2 | | Danltn.com Name: Daniel Neville Location: Danltn.com / Nottingham, UK Join Date: May 2007
Posts: 1,185
NP$: 0.56 ( Donate)
| 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 |
| |
03-05-2008, 03:34 PM
|
· #3 | | New Member | would there be a lot of code? how would i implement it site-wide?
Thanks... |
| |
03-05-2008, 07:45 PM
|
· #4 | | xrvel is cruel :-) Name: Kurniawan Location: Indonesia Join Date: Nov 2007
Posts: 1,094
NP$: 256.03 ( Donate)
| 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.
Last edited by xrvel : 03-07-2008 at 08:14 PM.
|
| |
03-07-2008, 01:04 PM
|
· #5 | | NamePros Regular Join Date: Mar 2005
Posts: 862
NP$: 81.00 ( Donate)
| 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/"); ?>  |
| |
03-07-2008, 08:09 PM
|
· #6 | | NamePros Regular Location: Tucson, AZ Join Date: Jul 2005
Posts: 649
NP$: 22.50 ( Donate)
| 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. |
| |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | |