Les Mizzell wrote:
> I've got a client that's requested a page that basically says:
>
> "You're now leaving our site to go visit ~name of external site here~"
>
> ....to come up for 5 or 10 seconds for each link on the site that goes to
> an external address. Turns out there's a ton of them too.
>
> Short of having to do something like the below for every single link:
>
> site-goodbye-page.cfm?extLINK=http://www.disney.com&linkTITLE=Disneyland
>
> Is there some automatic way to recognize an external link and accomplish
> this a little more easily?
Javascript. Something like:
links = getElementsByTagName("a");
for (var i = 0; i < links.length; i++) {
URL = links[i].getAttribute("href");
if (URL.match(/http/i) { /*Success!*/ }
// fix the data
links[i].setAttribute("href") =
"site-goodbye-page.cfm?extLINK=" + links[i].getAttribute("href");
}
}
Wrap in a cfhtmlhead and run on the page load. Won't catch
everything, but is good value for effort. You need to extend the
regex if you use absolute URIs in your site.
Jochem
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:228741
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54