Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how do i check the FireFox browsers?

Status
Not open for further replies.

Keendev

Technical User
Joined
Jan 23, 2006
Messages
106
Location
PH
hi,

how do i check the FireFox browsers?

hi got a free javascript scroll script and it runs on all
except on firefox.

and inside the script a function
Code:
function checkBrowser(){

this.ver=navigator.appVersion

this.dom=document.getElementById?1:0

this.ie5=(this.ver.indexOf("MSIE 5")>1 && this.dom)?1:0;

this.ie4=(document.all && !this.dom)?1:0;

this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;

this.ns4=(document.layers && !this.dom)?1:0;

this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)

return this

}

don't know yet why it is not working firefox..maybe it's on that code

pls advice.
thanks
 
also ,how do i add firefox to check in this block of code ?
if (ie || n6)
{
// do it
}

i think its also in there the problem...


thanks
 
Attack the problem from a different angle... get a different (free) scroll script that does work in Firefox (and all other browsers). The fact that the scroller you have relies on "browser sniffing" techniques (which were made redundant years ago) says to me that it is time for an upgrade to something else.

Good luck,
Jeff

[tt]Jeff's Page @ Code Couch
[/tt]

What is Javascript? FAQ216-6094
 
I agree. Move on - rewrite the code, not block it so it does not work on a modern, up-to-date browser.

Your code was clearly written a long time ago - it's time to modernise.

Dan



[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
last question..

how would I know if the user's current browser is firefox??

something like...
if (Browser is equal to Firefox)
{
//display message
// redirect to another page
}
else
//current page
}
 
Using similar code as you already use to determine if the browser is running as IE or NS. You will have to identify the unique portion of the navigator.userAgent string. You would probably use indexOf() looking for an occurance of "Firefox".

Cheers,
Jeff

[tt]Jeff's Page @ Code Couch
[/tt]

What is Javascript? FAQ216-6094
 
Code:
if (navigator.userAgent.indexof('Firefox') != -1) {

Although this is not 100% guaranteed, as some browsers have the ability to modify their user agent string.

I really cannot recommend highly enough that you modify your script to make this unnecessary. Perhaps if you posted the script and asked for help with modernising it, that would be a start?

Dan



[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top