avoid Javascript browser check

S

Sebastian Schöps

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
 
M

Michael Winter

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
 
S

Sebastian Schöps

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...
 
@

@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:[email protected]
Aide aux Pages Perso (images & couleurs, formulaire, CHP, JS)
http://perso.wanadoo.fr/stephanePOINTmoriaux/internet/
**************************************************************
 
M

Michael Winter

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
 
S

Sebastian Schöps

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...
 
T

Thomas 'PointedEars' Lahn

Sebastian said:
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
 
T

Thomas 'PointedEars' Lahn

Michael said:
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
 
D

Dauber!

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. :)
 
@

@SM

Thomas 'PointedEars' Lahn a ecrit :
Michael said:
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) ;-)

Same as IE : Edition / Preferences / and so one
 
T

Thomas 'PointedEars' Lahn

@SM said:
Thomas 'PointedEars' Lahn a *crit :

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 said:
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
 

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

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,152
Latest member
LorettaGur
Top