0

I want my php website to open only on internet-explorer while it shouldnt open on other browsers and also display message to them to view website on internet-explorer

i have tried this code below but it only displays message on updating the browsers

               <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>
  • Why would you want it? – Aakash Tushar Oct 18 '19 at 04:30
  • possible duplicate of [Internet Explorer 11 detection](https://stackoverflow.com/questions/21825157/internet-explorer-11-detection) and [Check if user is using IE](https://stackoverflow.com/questions/19999388/check-if-user-is-using-ie) – Zhi Lv Oct 18 '19 at 07:37

2 Answers2

1

Try this

$this->load->library('user_agent');
if ($this->agent->browser() != 'Internet Explorer'){
   echo "browser not supported";
}
lalit mittal
  • 444
  • 3
  • 8
1

if you wan to do this by JS than try this..

if((navigator.userAgent.indexOf("MSIE") != -1 ) || (!!document.documentMode == true )) //IF IE > 10
    {
        alert('EI');
    }else{
        alert('noooooo');
    }
Mannu saraswat
  • 1,061
  • 8
  • 15