Setting anchor target and Norton(?)

P

Pim Sohful

Hi,

I have a website full of external links. On the site I have a checkbox where
users can indicate that they want to have the link opened in a new window or
in the same window.

It is rather basic code:

var anchors = document.getElementsByTagName("a");
for (var i = 0; i < anchors.length; i++)
{ base = anchors.href;
if(base.substr(4,3)=="://") // is it external link?
{ if(flag=="Y")
anchors.target="_blank";
else
anchors.target="_self";
}
}

Unfortunately one of my users is reporting that he gets links that do not
work. I strongly suspect that it is some security program that disables the
links when they are touched by my script.. However, I cannot reproduce the
environment of this man (Safari + Norton), as I don't have neither.

Does anyone know about this kind of problem and have a suggestion how to
solve this?

Thanks,

Pim
 
P

Paul

Pim said:
Hi,

I have a website full of external links. On the site I have a checkbox where
users can indicate that they want to have the link opened in a new window or
in the same window.

It is rather basic code:

var anchors = document.getElementsByTagName("a");
for (var i = 0; i < anchors.length; i++)
{ base = anchors.href;
if(base.substr(4,3)=="://") // is it external link?
{ if(flag=="Y")
anchors.target="_blank";
else
anchors.target="_self";
}
}

Unfortunately one of my users is reporting that he gets links that do not
work. I strongly suspect that it is some security program that disables the
links when they are touched by my script.. However, I cannot reproduce the
environment of this man (Safari + Norton), as I don't have neither.

Does anyone know about this kind of problem and have a suggestion how to
solve this?

http://www.google.com/search?q=norton+javascript
 
S

Sam

Hi,

I have a website full of external links. On the site I have a checkbox where
users can indicate that they want to have the link opened in a new window or
in the same window.

It is rather basic code:

var anchors = document.getElementsByTagName("a");
for (var i = 0; i < anchors.length; i++)
{ base = anchors.href;
if(base.substr(4,3)=="://") // is it external link?
{ if(flag=="Y")
anchors.target="_blank";
else
anchors.target="_self";
}
}

Unfortunately one of my users is reporting that he gets links that do not
work. I strongly suspect that it is some security program that disables the
links when they are touched by my script.. However, I cannot reproduce the
environment of this man (Safari + Norton), as I don't have neither.

Does anyone know about this kind of problem and have a suggestion how to
solve this?

Thanks,

Pim


There's quite a few pop-up blocker programs out there that can cause that. Many
web browsers also have built-in options that may restrict that so there may not
be much work around for that. Maybe using something between the <head></head>
tags such as

<base target="_blank">

Not sure how to make that dynamic with Javascript though.

Sam
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top