# [Urgent] Script/Code Needed to open all external links in new window.., read on ..



## rahulw (May 13, 2007)

Hello,

I want to know how can i make users / visitors open all external links ( except forum links - means same domain ) in new window which should be containing my Advertisements...

For Example see this

If you go to this forum and click any link posted there by user, 

for example here it is

```
http://rapidshare.com/files/36742038/cs.wmv
```
it opens in new window like ... with advertisements ..


```
http://www.xboard.us/bbb/xb_pics.php?siteUrl=http://rapidshare.com/files/36742038/cs.wmv
```
Help Will Be Appreciated .


----------



## rahulw (May 13, 2007)

i got this from there website 

this is javascript there are using 


```
/*
Copyright (c) 2006. All Rights Reserved.
This script may not be reproduced or distributed in any form without written permission of the owner.
*/

var url="http://www.xboard.us/bbb/xb_pics.php?siteUrl=";
var domains='xboard.us,filescheap.com,desiproject.com,xb-wiki.com,bollygallery.com,yummycurry.com,picscrazy.com,ybored.com,xb-blogs.com';
function c(){var link=document.getElementsByTagName("A");try{var loc=(""+top.location.href).replace("http://","").replace("https://","").replace("www.","");}catch(e){var loc=(""+document.location.href).replace("http://","").replace("https://","").replace("www.","");}for(i=0;i<link.length;i++){domain_url=(""+link[i].href).replace(/^\s+/g,"").replace(/\s+$/g,"").replace("http://","").replace("https://","");if(d(link[i].href)&&(((" "+link[i].href).indexOf(loc)<=0||(" "+link[i].href).indexOf("http")<=0)||(" "+link[i].href).lastIndexOf("http:")>3)&&(" "+link[i].href).indexOf("script:")<=0&&(" "+link[i].href).indexOf("#")!=1&&(" "+link[i].href).indexOf("mailto:")<=0&&(" "+link[i].href).indexOf("file:")<=0&&(" "+link[i].href).indexOf("#exit")<=0&&!(!isNaN(parseInt(domain_url.substr(0,1)))&&(!isNaN(parseInt(domain_url.substr(0,2)))||domain_url.substr(0,2)=="."))){link[i].target="_blank";link[i].href=url+link[i]+"";}}}function d(url){if(""+domains!="undefined"&&domains!=""&&domains.replace(/\s/g,"")!=""&&url!=""){if((" "+domains).indexOf(",")>0){params_to_skip=domains.split(",");}else{params_to_skip=new Array(domains);}for(s=0;s<params_to_skip.length;s++){if((" "+url.toLowerCase()).indexOf(params_to_skip[s].toLowerCase())>0){return false;break;};}return true;}else{return true;}}if(""+window.onload==""||""+window.onload=="null"){window.onload=c;}else{var tout=window.setTimeout("c(); clearTimeout(tout)",4000);};
```

i can use this but , how shall i get 


```
var url="http://www.xboard.us/bbb/xb_pics.php?siteUrl=";
```
 file ... to edit the ad codes ??


----------



## rahulw (May 13, 2007)

reply someone


----------



## rahulw (May 13, 2007)

dead forum


----------



## rahulw (May 13, 2007)

Dead Place !!!!! :d


----------



## carsey (Aug 19, 2006)

You will need to make a javascript popup and then have it open the links in the window.

Sorry, i dont know the coding for this


----------



## rahulw (May 13, 2007)

carsey said:


> You will need to make a javascript popup and then have it open the links in the window.
> 
> Sorry, i dont know the coding for this


I believe some one can atleast continue the code i provide in this so called " tech support forum" :laugh:

where are all the "techies" :4-dontkno


----------



## ebackhus (Apr 21, 2005)

Rudeness won't help you get what you're looking for.

Just insert *target="new"* into any tag you create for links.


----------



## rahulw (May 13, 2007)

ebackhus said:


> Rudeness won't help you get what you're looking for.
> 
> Just insert *target="new"* into any tag you create for links.




lol .. its not that way ,
but never the less i got it myself as usual ...

here is how to do it .. for anyone who needs help ...




> http://mods.invisionize.com/db/index.php/f/1452


Topic Closed :wave:


----------

