Stylegala Forums » Forums list » Problem solving
Adding an exception
Adding an exception
| Author | Message |
|---|---|
|
Nimbuz Junior member
|
Hi,
I'm using the following script to open all external links in new window:
function externalLinks() {
but I want to add an exception, like open http://google.com and http://www.google.com in same window. Thanks |
| Sponsor | |
|
Bill Posters Site Moderator
|
function externalLinks() {
In my tests, I've found that comparing the href to window.location.hostname property provides a more reliable means of addressing external links (when using standard, W3C DOM scripting). Some browsers invisibly prepend the http:// to absolute, internal links (made absolute by using the root slash). This means that looking for the http:// string in the href will sometimes return false positives. Fwiw, here's my own fairly exhaustive efforts (from a while back) on the issue of targeting new windows for external links. Flag & toggle external links _________________ aka 'clemi' |
Page 1 of 1
Powered by phpBB. © 2001, 2006 phpBB Group & Logo Design
Post new topic
Reply to topic