gpt4 book ai didi

ruby-on-rails - Rails - 阻止 Internet Explorer

转载 作者:行者123 更新时间:2023-12-01 02:03:55 26 4
gpt4 key购买 nike

有没有办法阻止 Internet Explorer 访问 Web 应用程序?

事实上,我不介意显示一个通知他们下载 Firefox 的静态页面。我想停止支持 IE,但我不确定最好的方法。

最佳答案

检测浏览器的方法基本上有三种。

  1. Check the user agent .这种方法不可靠,一般应该不使用,但在某些情况下可能没问题。
  2. Check javascript object support .通常这样做在执行 javascript 代码时,这是一件好事在尝试使用对象之前确保对象存在。有一些可能只在 IE 中定义的对象,但有一些其他浏览器将对象定义为的机会好吧。
  3. Use conditional comments .这是我将使用的路线,因为您正在寻找专门针对 IE 的(有条件的评论仅适用到 IE)。此选项还将使您能够定位某些可靠的 IE 版本。

这是一个在浏览器为 IE <= 7 时会重定向的示例。

<!--[if lte IE 7]>
<script>
window.location = 'download-firefox.html';
</script>
<![endif]-->

关于ruby-on-rails - Rails - 阻止 Internet Explorer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8403128/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com