By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,384 Members | 1,829 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,384 IT Pros & Developers. It's quick & easy.

avoid Javascript browser check

P: n/a
Hello all,

I have to access a website which does a stupid browser check and only
accepts Netscape 4.7. The problem is that I have to access the website with
Mozilla or Internet Explorer.

Query:
if ((browserType.indexOf("etscape") != -1) && (browserVersion.indexOf("4.7")
!= -1))

I have no succes when I change the useragent object (Mozilla:
generals.useragent.override; IE via registry):

Mozilla Mozilla/4.7 [en] (Windows NT 5.0; U) => appName = Netscape,
appVersion = 5.0
IE Mozilla/4.7 (Windows NT 5.0, U) => appName = Internet
Explorer, appVersion = 4.7

I suppose that javascript doesn't get the information from useragent, but
from somewhere different...

Anyone an idea how to avoid this annoying browser check?

Thanks in advance, any idea appreciated!

Regards Seb

Jul 20 '05 #1
Share this Question
Share on Google+
11 Replies


P: n/a
Sebastian Schöps wrote on 13 Dec 2003 at Sat, 13 Dec 2003 17:54:09
GMT:
The problem is that I have to access the website with Mozilla or
Internet Explorer.
I hope you're planning to support more than those two. There are /so/
many more browsers on the market now, and I'm not just talking about
Opera and Mozilla. Don't alienate your potential users.
I suppose that javascript doesn't get the information from
useragent, but from somewhere different...

Anyone an idea how to avoid this annoying browser check?


It would be better to know what you need the checks for. I don't
think anyone will be able to give totally accurate advice without
knowing that.

If it's to choose what properties or methods to use in order to
accomplish an action, then you should use feature detection. I
can't think of a particularly poignant example (I don't touch
DHTML), however I know that document.all is non-standard
collection, primarily used by Internet Explorer (though I've heard
Opera supports it, too). You could test for it's availability like
so:

if (document.all) {
// document.all supported (IE and Opera)
} else {
// not supported (NS and Mozilla)
//
// can use document.getElementById instead (should be tested as
// well)
}

Mike

--
Michael Winter
M.******@blueyonder.co.invalid (replace ".invalid" with ".uk")
Jul 20 '05 #2

P: n/a
Sorry, litte misunderstanding.

This website is already running and I want to access it with IE or Mozilla,
but you must have Netscape 4.7 to access it. I would never create a website
that does such an annoying browser check...

"Michael Winter" <M.******@blueyonder.co.invalid> schrieb im Newsbeitrag
news:Xn*******************************@193.38.113. 46...
Sebastian Schöps wrote on 13 Dec 2003 at Sat, 13 Dec 2003 17:54:09
GMT:
The problem is that I have to access the website with Mozilla or
Internet Explorer.


I hope you're planning to support more than those two. There are /so/
many more browsers on the market now, and I'm not just talking about
Opera and Mozilla. Don't alienate your potential users.
I suppose that javascript doesn't get the information from
useragent, but from somewhere different...

Anyone an idea how to avoid this annoying browser check?


It would be better to know what you need the checks for. I don't
think anyone will be able to give totally accurate advice without
knowing that.

If it's to choose what properties or methods to use in order to
accomplish an action, then you should use feature detection. I
can't think of a particularly poignant example (I don't touch
DHTML), however I know that document.all is non-standard
collection, primarily used by Internet Explorer (though I've heard
Opera supports it, too). You could test for it's availability like
so:

if (document.all) {
// document.all supported (IE and Opera)
} else {
// not supported (NS and Mozilla)
//
// can use document.getElementById instead (should be tested as
// well)
}

Mike

--
Michael Winter
M.******@blueyonder.co.invalid (replace ".invalid" with ".uk")

Jul 20 '05 #3

P: n/a
@SM
"Sebastian Schöps" a ecrit :
Sorry, litte misunderstanding.

This website is already running and I want to access it with IE or Mozilla,
but you must have Netscape 4.7 to access it. I would never create a website
that does such an annoying browser check...


may we have url of this site ?
to try .

its querry about browser
was exactly what you gave ?

to turn preferences in IE or Mozilla for it appears as NC4.7
I dont know ..

--
************************************************** ************
Stéphane MORIAUX : mailto:st*********************@wanadoo.fr
Aide aux Pages Perso (images & couleurs, formulaire, CHP, JS)
http://perso.wanadoo.fr/stephanePOINTmoriaux/internet/
************************************************** ************
Jul 20 '05 #4

P: n/a
Sebastian Schöps wrote on 13 Dec 2003 at Sat, 13 Dec 2003 21:25:53
GMT:
Sorry, litte misunderstanding.

This website is already running and I want to access it with IE
or Mozilla, but you must have Netscape 4.7 to access it. I would
never create a website that does such an annoying browser
check...


My apologies. Unfortunately, there's not much we can do about that. I
would try to contact the webmaster and tell him or her what an idiot
they are for restricting entry to the site with such an out-dated,
badly-written script.

One way into the site would be to disable JavaScript in your browser
preferences, but I've never been able to do that in IE. I would
imagine that it's fairly trivial in Mozilla. To me though, that is
far too much trouble anyway: a user should never have to do anything
like that just to use a website.

Mike

--
Michael Winter
M.******@blueyonder.co.invalid (replace ".invalid" with ".uk")
Jul 20 '05 #5

P: n/a
Sorry, site is in intranet, but this is the source that is affected:

<HTML>
<script language="Javascript">
var browserType;
var browserVersion;
browserType = navigator.appName;
browserVersion = navigator.appVersion;

if( (browserType.indexOf("etscape") != -1) && (browserVersion.indexOf("4.7") != -1) )
alert("Access")
else
alert("No access")
</script>
</HTML>

Just copy and paste it in a html file. Pretty easy query, but I can't trick it... grrrrr...
"@SM" <st**************@wanadoo.fr> schrieb im Newsbeitrag news:3F************@wanadoo.fr...
"Sebastian Schöps" a ecrit :
Sorry, litte misunderstanding.

This website is already running and I want to access it with IE or Mozilla,
but you must have Netscape 4.7 to access it. I would never create a website
that does such an annoying browser check...


may we have url of this site ?
to try .

its querry about browser
was exactly what you gave ?

to turn preferences in IE or Mozilla for it appears as NC4.7
I dont know ..

--
************************************************** ************
Stéphane MORIAUX : mailto:st*********************@wanadoo.fr
Aide aux Pages Perso (images & couleurs, formulaire, CHP, JS)
http://perso.wanadoo.fr/stephanePOINTmoriaux/internet/
************************************************** ************

Jul 20 '05 #6

P: n/a
Sebastian Schöps wrote:
I have to access a website which does a stupid browser check and only
accepts Netscape 4.7. The problem is that I have to access the website with
Mozilla or Internet Explorer.
With Mozilla/5.0 install http://prefbar.mozdev.org/ which
includes a GUI (exactly: a configurable dropdown box) for
the pref `general.useragent.override'. Although quite old,
it is compatible with recent builds.

I am afraid there is no way to access that page with IE
other than disabling script support.
Query:
if ((browserType.indexOf("etscape") != -1) && (browserVersion.indexOf("4.7")
!= -1))


Oh my! Send the crackpot^W author who did this
to http://pointedears.de.vu/scripts/test/whatami
PointedEars
Jul 20 '05 #7

P: n/a
Michael Winter wrote:
One way into the site would be to disable JavaScript in your browser
preferences, but I've never been able to do that in IE. [...]
Internet Options, Security, $Zone (here: Internet Zone),
Active Scripting, (x) Disabled (or like that, I only have
German IEs here.)
I would imagine that it's fairly trivial in Mozilla.


Install and use the Prefbar (see other followup) or uncheck Edit,
Preferences, Advanced, Script & Plug-ins, Enable JavaScript for: Navigator.
PointedEars
--
Never give up! Never surrender!
-- Cmdr. Peter Quincy Taggart in "Galaxy Quest"
Jul 20 '05 #8

P: n/a
Waaaaay back on 13-Dec-03 18:57:42, Michael Winter said this about [OT] Re: avoid Javascript browser check:
My apologies. Unfortunately, there's not much we can do about that. I
would try to contact the webmaster and tell him or her what an idiot
they are for restricting entry to the site with such an out-dated,
badly-written script.


That's one of the many cool things about Amiga's IBrowse browser...you can
spoof it to fool the page into thinking it's a certain version of another
browser...and you can actually edit the source code locally and make the
browser act based on your modified version of the source code. :)

--
da****@banana-and-louie.amiga.roolz.org * dauber.50megs.com
* ICQ: 28677921 * YIM: dau_ber * AIM: ddaauubbeerr

Jul 20 '05 #9

P: n/a
@SM

Thomas 'PointedEars' Lahn a *crit :
With Mozilla/5.0


What is this Mozilla/5.0
Mine is Mozilla 1.2 (French for Mac PPC system 8 & 9 )
--
************************************************** ************
Stéphane MORIAUX : mailto:st*********************@wanadoo.fr

Jul 20 '05 #10

P: n/a
@SM
Thomas 'PointedEars' Lahn a ecrit :
Michael Winter wrote:
One way into the site would be to disable JavaScript in your browser
preferences, but I've never been able to do that in IE. [...]


Internet Options,


On Mac : menu Editions / Preferences / and then have a look (search a fiew) ;-)
I would imagine that it's fairly trivial in Mozilla.


Same as IE : Edition / Preferences / and so one
--
************************************************** ************
Stéphane MORIAUX : mailto:st*********************@wanadoo.fr

Jul 20 '05 #11

P: n/a
@SM wrote:
Thomas 'PointedEars' Lahn a *crit :
With Mozilla/5.0
What is this Mozilla/5.0


The simplest definition is that Mozilla/5.0 include
all user agents that use the Gecko layout engine.
See <http://mozilla.org/> for details.
Mine is Mozilla 1.2 (French for Mac PPC system 8 & 9 )


Non sequitur. Yours is Mozilla/5.0, release version (rv) 1.2.
Type javascript:navigator.userAgent in the Location Bar or
select Help, About (or whatever it is captioned in French).
PointedEars
Jul 20 '05 #12

This discussion thread is closed

Replies have been disabled for this discussion.