[thelist] Handling external links with JS

Toby Mills toby at tobymills.com
Thu Feb 5 11:37:54 CST 2004


I mentioned the depreciation of the target property because your code looked
like it used it: anchors[i].setAttribute("target","_blank");

I find that by doing <a href='http://siteurl' onclick="return
newWin(this)"></a>
And then having a function newWin which opens a new window and returns false
to prevent the event from loading in that window.

Just a thought.

What's the rest of your code? I tried the solution I posted on one of my asp
pages as: 
	if(window.location.href.toLowerCase().indexOf(".asp") >= 0){
		alert('ASP Page')
	} 
and that worked fine. 

T
-------------------------------
toby mills
web developer & programmer


www.tobymills.com

 


-----Original Message-----
From: thelist-bounces at lists.evolt.org
[mailto:thelist-bounces at lists.evolt.org] On Behalf Of Brian Cummiskey
Sent: 05 February 2004 17:16
To: thelist at lists.evolt.org
Subject: RE: [thelist] Handling external links with JS


>> Firstly, the target attribute for links is being depreciated by the
W3C. The best method I have found to get around this >> is to use
javascript to open the link in a new window. <<

Right, that's why im wanting to use this script in the first place.
Instead of a pop() function, it will automatically pop a new window via
javascript.

>> Otherwise, to answer your question, try :
>> if(window.location.href.toLowerCase().indexOf("out.php") >= 0){/*is
out page*/}

Thanks for trying, but it doesn't work either :(



-- 
* * Please support the community that supports you.  * *
http://evolt.org/help_support_evolt/

For unsubscribe and other options, including the Tip Harvester 
and archives of thelist go to: http://lists.evolt.org 
Workers of the Web, evolt ! 




More information about the thelist mailing list