[thelist] Handling external links with JS

Hassan Schroeder hassan at webtuitive.com
Thu Feb 5 13:17:54 CST 2004


Brian Cummiskey wrote:

> I created/found/messed with/tweaked a simple function to handle external
> links without using a <a "rel=external" href..."> or a target attribute
> to keep a xhtml strict DTD.

> if(href.indexOf("out.php") == 1){ // Href is on an out page

if(href.indexOf("out.php") > -1)

Try an alert of `href` -- it'll be a full url, something like
"http://my.example.com/out.php", so the position of "out.php" is
certainly not going to be "1".  :-)

HTH!
-- 
Hassan Schroeder ----------------------------- hassan at webtuitive.com
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

                           dream.  code.





More information about the thelist mailing list