Open link with another browser

Asked

Viewed 2,498 times

-1

Hello, I have a program that only opens in IE, but not every client accesses your documents for it. I wonder if there is a way, when the customer pressed the boot button he 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 didn’t work.

  • 1

    For PHP That’s impossible, even if it were for Javascript for security reasons, I didn’t quite understand your doubt why you used this tag. So the program in question is command line or PHP?

  • In PHP, but I read in a forum that you could do using this code.

  • 1

    Could you point to the source? Just to mention PHP is Back-End, IE, what happens is on the server side, it would be more plausible to do for Javascript that is Front-End, and yet security prevents. Could explain exactly what this software that your friend is doing, is a company-oriented browser?

  • Yes. From what he told me the file makes many requests and then enters a download page. At the time of this download can not download by Chrome or Firefox. The only ones who can download and IE and operates.

  • The source? That forum?

  • http://www.hardware.com.br/comunidade/abrir-link/1465953/

  • 2

    Sorry for the delay, I read the link conversation just now, so most of you there don’t seem to know what you’re talking about. It would be better to block the page by useragent thus preventing the client from using another browser other than IE.

Show 2 more comments

1 answer

2


I only know of one method that forces the user to use the default browser. On your site you will have to put javascript code that checks the browser used, if it is IE of 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 instructions to the client always open by IE.

Now if you prefer to do it by PHP the code would be 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>
  • Thank you. I will use here.

  • 1

    I hope you’ve solved

Browser other questions tagged

You are not signed in. Login or sign up in order to post.