Unstoppable Domains โ€” Expired Auctions

Forcing external links to open in a new window

SpaceshipSpaceship
Watch

gridsix

Established Member
Impact
0
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!
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
Unstoppable Domains โ€” AI StorefrontUnstoppable Domains โ€” AI Storefront
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
 
0
•••
would there be a lot of code? how would i implement it site-wide?

Thanks...
 
0
•••
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:
0
•••
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/"); ?>

:)
 
0
•••
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.
 
0
•••
Spaceship
Domain Recover
NameMaxi - Your Domain Has Buyers
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back