PDA

View Full Version : Browser Detection


caclark
05-08-2003, 08:57 PM
I am trying to detect a specific browser when someone clicks on a link. If this specific browser (in this case Netscape) is detected then I want to pop-up an alert box, but NOT continue onto the "href" link. But when any other browser is detected, I just want to go directly to the "href" link -no alert box.

The box pop's up correctly when Netscape is detected, and no "href" link is done. :thumbsup:

But when any other browser is detected the link given in the "href" is not executed. :mad:

What am I overlooking? :confused:

sample link code below:

<a href="Put Your Link HERE" onClick='javascript:if (navigator.appName=="Netscape")alert("This Link Will Not Work With Netscape");return false'>Put Your Link Name HERE</a>

arnyinc
05-08-2003, 09:03 PM
You need brackets around the two commands in your if-statement.

onClick='javascript:if (navigator.appName=="Netscape"){alert("This Link Will Not Work With Netscape");return false}'

Right now it is executing the return false every time because it is not part of your if-statement. That is why it never follows the HREF.

caclark
05-08-2003, 09:09 PM
Thanks arnyinc.

I knew it has to be something simple I was overlooking.:)