避免Javascript浏览器检查 [英] avoid Javascript browser check

查看:93
本文介绍了避免Javascript浏览器检查的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我必须访问一个执行愚蠢浏览器检查的网站,并且只有
接受Netscape 4.7。问题是我必须使用

Mozilla或Internet Explorer访问该网站。


查询:

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

!= -1))


当我更改useragent对象时,我没有成功(Mozilla:

generals.useragent.override; IE通过注册表):


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 =互联网

资源管理器,appVersion = 4.7


来自不同的地方...


任何人都知道如何避免这种烦人的浏览器检查?


在此先感谢,任何想法都赞赏!


问候Seb

解决方案

Sebastian Sch?ps于2003年12月13日周六写道,2003年12月13日17:54:09

GMT:

问题是我必须使用Mozilla或
Internet Explorer访问该网站。


我希望你计划支持超过这两个。现在市场上有更多的浏览器,而且我不只是在谈论

Opera和Mozilla。不要疏远你的潜在用户。

我想javascript没有得到来自
useragent的信息,但来自不同的地方...

任何人都知道如何避免这种烦人的浏览器检查?




最好知道你需要检查什么。我不认为b $ b认为任何人都可以提供完全准确的建议,而不知道




如果它'要选择使用哪些属性或方法来完成某个操作,然后你应该使用特征检测。我不能想到一个特别尖锐的例子(我不会碰到

DHTML),但我知道document.all是非标准的

集合,主要由Internet Explorer使用(虽然我听说过

Opera也支持它)。您可以测试它的可用性,例如

所以:


if(document.all){

//文件.all支持(IE和Opera)

}否则{

//不支持(NS和Mozilla)

//

//可以使用document.getElementById(应该测试为

//井)

}


迈克


-

Michael Winter
M。****** @ blueyonder.co.inva 盖子(将.invalid替换为.uk)


对不起,小小的误会。


这个网站已经运行了,我想用IE或Mozilla访问它,

但你必须有Netscape 4.7才能访问它。我永远不会创建一个网站

这样做一个恼人的浏览器检查...


Michael Winter < M ****** @ blueyonder.co.invalid>。 schrieb im Newsbeitrag

新闻:Xn ******************************* @ 193.38.113。 46 ...

Sebastian Sch?ps于2003年12月13日在2003年12月13日星期六17:54:09写道
GMT:

问题是我必须使用Mozilla或
Internet Explorer访问该网站。



我希望您计划支持超过这两个。现在市场上还有更多的浏览器,我不只是在谈论Opera和Mozilla。不要疏远你的潜在用户。

我认为javascript没有从
useragent获取信息,但来自不同的地方......

任何人都知道如何避免这种恼人的浏览器检查?



最好知道你需要检查什么。我不认为任何人都能够在没有知道的情况下提供完全准确的建议。

如果要选择使用哪些属性或方法要完成一个动作,那么你应该使用特征检测。我不能想到一个特别尖锐的例子(我不接触DHTML),但是我知道document.all是非标准的集合,主要用于互联网资源管理器(虽然我听说过Opera也支持它)。您可以测试它的可用性,如
所以:

if(document.all){
// document.all支持(IE和Opera)
} else {
//不支持(NS和Mozilla)
//
//可以使用document.getElementById(应该测试为
//)
}

Mike

-
Michael Winter
M。****** @ blueyonder.co.inva lid(将.invalid替换为.uk)


< br>

" Sebastian Sch?ps" ecrit:

抱歉,小小的误会。

这个网站已经运行了,我想用IE或Mozilla访问它,
但是你必须有Netscape 4.7才能访问它。我永远不会创建一个网站
做这么烦人的浏览器检查...




我们可能有这个网站的网址吗?

尝试。


关于浏览器的问题

正是你给的那个?


来转向偏好在IE或Mozilla中它显示为NC4.7

我不知道..


-

**** ********************************************** **** ********
$ b $bStéphaneMORIAUX:mailto:st ********************* @ wanadoo.fr

Aide aux Pages Perso(图片& couleurs,formulaire,CHP,JS)
http://perso.wanadoo.fr/stephanePOINTmoriaux/internet/

****************** ******************************** ************


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

解决方案

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")


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")



"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/
************************************************** ************


这篇关于避免Javascript浏览器检查的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆