Open link with another browser

-1

Hello, I have a program that only opens in IE, but not every client accesses your documents for it. I would like to know if you have how, when the client pressed the boot button it would redirect to open the link in IE.

The program is not mine so I can not post part of it.

system("cmd /C 
Start
"C:\Program Files\Internet Explorer\iexplore.exe"https://www.link.com.br/
EXIT");

I tried this way but it did not work.

    
asked by anonymous 21.02.2018 / 02:12

1 answer

2

I only know one method that forces the user to use the default browser. On your site you will have to by the javascript code that check the browser used, if it is IE any version will not do anything, if it is any other browser will redirect.

var ua = window.navigator.userAgent;
var msie = ua.indexOf("MSIE ");
if (msie < 1){
   window.location.href = "naoeie.html";
}

If you want to check only after loading the page the code should be a function called by onload :

window.onload = function(){checkMsie()}

function checkMsie(){
    var ua = window.navigator.userAgent;
    var msie = ua.indexOf("MSIE ");
    if (msie < 1){
       window.location.href = "naoeie.html";
    }
}

Being the name of the file naoeie.html just an example, on this page you will put the pro instructions client always open by IE.

Now if you prefer to do it for PHP the code would look like this:

<?php
$ua = $_SERVER['HTTP_USER_AGENT'];
if(!preg_match('/(MSIE|Trident)/i',$ua)){
   echo "Você não está usando internet explorer";
   exit(); //Para o carregamento da página
}
?>
<!DOCTYPE html>
<html>
   <head>
      <title>Bem vindo ao meu site!</title>
   </head>
   <body>
      CONTEÚDO DO SEU SITE PARA INTERNET EXPLORER
   </body>
</html>
    
27.02.2018 / 16:22