浏览器检测
我需要将 IE 和 FF 浏览器与其他浏览器分开,
这是一个伪代码:
If (CurrentBrowser == IE(6+) or FF(2+) )
{
...
}
else
{
...
}
在 protected void Page_Load()
事件中(这样认为)
if ((Request.Browser.Type == "IE") || (Request.Browser.Type == "FF"))
{
WebMsgBox.Show("1111");
}
没有效果:-/ IE 和 FF 类型是什么?
I need to separate IE and FF browsers from others
it's a pseudo-code :
If (CurrentBrowser == IE(6+) or FF(2+) )
{
...
}
else
{
...
}
in protected void Page_Load()
event (think so)
if ((Request.Browser.Type == "IE") || (Request.Browser.Type == "FF"))
{
WebMsgBox.Show("1111");
}
no effects :-/ what is IE and FF types?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
您可以通过以下方式请求有关正在使用的浏览器的信息,您可以使用它来执行 if 语句
MSDN 文章
Here's a way you can request info about the browser being used, you can use this to do your if statement
MSDN Article
尝试下面的代码
Try the below code
我不建议使用 JS 手动破解特定于浏览器的内容。使用“prototype”或“jquery”等 JavaScript 库,它将透明地处理所有特定问题。
或者如果确实需要的话,可以使用这些库来确定浏览器类型。
另请参阅浏览器和浏览器原型库中的版本?
I would not advise hacking browser-specific things manually with JS. Either use a javascript library like "prototype" or "jquery", which will handle all the specific issues transparently.
Or use these libs to determine the browser type if you really must.
Also see Browser & version in prototype library?
为了浏览器兼容性,您可以使用此代码。此方法返回浏览器名称和版本:
For browser compatibility you can use this code. This method returns browser name and version :
我尝试并找到了相同的解决方案
I tried and found the solution for the same
从此链接使用
将帮助您:
使用 ASP.NET 和 C# 检测浏览器
use from
this link will help you :
Detect the browser using ASP.NET and C#