我希望我的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>
试试这个
$this->load->library('user_agent');
if ($this->agent->browser() != 'Internet Explorer'){
echo "browser not supported";
}
如果你想通过JS来做这件事,那就试试这个。
if((navigator.userAgent.indexOf("MSIE") != -1 ) || (!!document.documentMode == true )) //IF IE > 10
{
alert('EI');
}else{
alert('noooooo');
}