如何仅在Internet Explorer中加载网站,而不能在其他浏览器上打开

问题描述 投票:0回答:2

我希望我的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>
php html codeigniter internet-explorer browser
2个回答
1
投票
尝试一下

1
投票
[如果您想用JS来做,而不是去尝试。。

0
投票
这是一个js代码,您可以在其中标识任何浏览器,并根据它可以显示页面

// Opera 8.0+ var isOpera = (!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0; // Firefox 1.0+ var isFirefox = typeof InstallTrigger !== 'undefined'; // Safari 3.0+ "[object HTMLElementConstructor]" var isSafari = /constructor/i.test(window.HTMLElement) || (function (p) { return p.toString() === "[object SafariRemoteNotification]"; })(!window['safari'] || (typeof safari !== 'undefined' && safari.pushNotification)); // Chrome 1 - 71 var isChrome = !!window.chrome && (!!window.chrome.webstore || !!window.chrome.runtime); // Blink engine detection var isBlink = (isChrome || isOpera) && !!window.CSS; ------------------------- // Internet Explorer 6-11 var isIE = /*@cc_on!@*/false || !!document.documentMode; // Edge 20+ var isEdge = !isIE && !!window.StyleMedia; if(isIE){ //show body }else{ //show message }

© www.soinside.com 2019 - 2024. All rights reserved.