php - 如何仅在 Internet Explorer 中加载网站而不在其他浏览器上打开
问题描述
我希望我的 php 网站仅在 internet-explorer 上打开,而它不应该在其他浏览器上打开,并且还向他们显示消息以在 internet-explorer 上查看网站
我在下面尝试过这段代码,但它只显示更新浏览器的消息
<script>
var $buoop = {required:
{e:-4,f:-3,o:-3,s:-1,c:-3},insecure:true,api:2019.10 };
function $buo_f(){
v ar e = document.createElement("script");
e.src = "//browser-update.org/update.min.js";
document.body.appendChild(e);
};
try {document.addEventListener("DOMContentLoaded",
$buo_f,false)}
catch(e){window.attachEvent("onload", $buo_f)}
</script>
解决方案
如果你想通过 JS 来做这件事而不是试试这个..
if((navigator.userAgent.indexOf("MSIE") != -1 ) || (!!document.documentMode == true )) //IF IE > 10
{
alert('EI');
}else{
alert('noooooo');
}
推荐阅读
- android - 带有 Kotlin StateFlow 的 TextField
- node.js - Monorepo 和构建软件包的问题
- javascript - JavaScript设置一个表单字段的初始值,为另一个字段的相同值?
- python - Python - 如何加快代码创建随机列表并在发现回文时停止?
- javascript - 为什么我的不和谐角色返回未定义?
- python - 如何将另一个预训练的 BERT 模型与 ktrain 文本分类器一起使用?
- ember.js - Ember-CLI v0.0.44 项目未使用“在严格模式下使用 const”构建。错误信息
- odoo - 问题:在 Fedora 32 中安装 odoo 时请求冲突
- python - 无法使用 Python 在 PySimpleGui 表中显示来自 MongoDB 数据库的数据
- download - 金字塔力下载生成文件