Javascript 提醒用户在IE或fire fox浏览器中打开应用程序

Javascript 提醒用户在IE或fire fox浏览器中打开应用程序,javascript,asp.net,Javascript,Asp.net,当任何用户试图打开除mozilla(fire fox)或IE浏览器以外的应用程序时,我们需要提醒用户,请在IE或Firefox浏览器中打开该应用程序。他打开应用程序的浏览器应该停止,我们不应该关闭他打开的浏览器 例如:像其他浏览器一样(谷歌crome、opera) 因此,首先我需要检查他们运行应用程序的浏览器,我需要发送一条警报消息 在此方面的任何帮助都将不胜感激 感谢使用javascript navigator对象检查浏览器,然后提醒用户 <script type="text/java

当任何用户试图打开除mozilla(fire fox)或IE浏览器以外的应用程序时,我们需要提醒用户,请在IE或Firefox浏览器中打开该应用程序。他打开应用程序的浏览器应该停止,我们不应该关闭他打开的浏览器 例如:像其他浏览器一样(谷歌crome、opera)

因此,首先我需要检查他们运行应用程序的浏览器,我需要发送一条警报消息

在此方面的任何帮助都将不胜感激


感谢使用javascript navigator对象检查浏览器,然后提醒用户

 <script type="text/javascript">
 document.write("Browser CodeName: " + navigator.appCodeName);
 document.write("<br /><br />");
 document.write("Browser Name: " + navigator.appName);
 document.write("<br /><br />");
 document.write("Browser Version: " + navigator.appVersion);
 document.write("Platform: " + navigator.platform);
 document.write("<br /><br />");
 document.write("User-agent header: " + navigator.userAgent);
 </script>

document.write(“浏览器代号:”+navigator.appCodeName);
文件。写(“

”); document.write(“浏览器名称:”+navigator.appName); 文件。写(“

”); document.write(“浏览器版本:”+navigator.appVersion); 编写(“平台:+navigator.Platform”); 文件。写(“

”); document.write(“用户代理标题:”+navigator.userAgent);
检查HttpContext.Current.Request.Browser,请参阅这是要使用的条件:

<script>
if ((navigator.appName == "Microsoft Internet Explorer") &&
    (parseInt(navigator.appVersion) >= 4)) {
} else if (window.sidebar) {
} else {
    alert("Please open the site in IE or Firefox");
}
</script>

如果((navigator.appName==“Microsoft Internet Explorer”)&&
(parseInt(navigator.appVersion)>=4){
}else if(窗口侧栏){
}否则{
警告(“请在IE或Firefox中打开网站”);
}

您不能这样做

您所依赖的任何内容都将由浏览器提供,您不能相信这一点

任何人都可以操纵他们的浏览器来谎报他们是谁,看看firefox吧


最好对你的网站进行分类,使其支持多个浏览器…

应用程序你指的是一个网页?你绝对肯定你的应用程序不会在其他浏览器中工作吗?阻止特定的浏览器是如此的1998年-你能用“你的浏览器不受支持,自行承担风险”来解决它吗?此外,并非所有使用Gecko渲染器的浏览器都识别为“Firefox”——尽管这是最常见的浏览器。请看下面的例子:这个问题可能不是一个好主意,但为什么投反对票?它是复制品吗?不清楚吗?这个问题不应该被否决+一个浏览器的用户代理字符串嗅探和假设某个特定功能只在不同的特定浏览器上可用的奇怪组合。