Open PHP link in another browser

Asked

Viewed 2,015 times

0

I would like to open a link that I have on my page in a specific browser (IE). For example, if I am using Google Chrome, I would like to open the link in Internet Explorer when clicked. Is there a PHP function to help me?

1 answer

1

There are two functions in php that can help you exec() and shell_exec()

Example using the exec:

exec("C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe http://www.google.com");

But this will work on localhost, but it won’t work on the web, because PHP runs on the server, so it doesn’t have access to client directories.

OBS: This will open the browser on the server, not on the client side.

OBS 2: If possible, there is no way to know if the client has a particular browser installed.

OBS 3: In my opinion this violates the right of choice of the customer, because if the customer chooses to use the browser X, it has its reasons and for sure it would not like to click on a link and open the browser Y.

References:

Hardware

iMasters

  • This opens a browser on the server. I do not know if this is what Rodrigo wants. If the server is remote, this is not very useful.

  • @Blunt, he’s not specific in the question, but I’ve already added in the answer that only runs on the server.

  • It would be necessary to open in specific browser, because the content loaded in this link opens only in IE. It is an intranet and local wheel. There is no way to do this with these functions?

  • A solution if they use Firefox would use the Firefox Open With, and users/customers are aware that a given link only opens on IE. http://pplware.sapo.pt/browsers/firefox-open-with-abrir-links-com-outros-browsers/

  • But we really wanted the link to call IE with the last address. Location, on the customer’s machine.

  • One would have an example in PHP of this usage: exec("C: Program Files (x86) Mozilla Firefox firefox.exe http://www.google.com"); ?

  • As I said, this is not possible, because PHP does not run on the client side but on the server side, these functions called the browser on the server side and not the client side.

  • I got what I need as follows: $output = shell_exec('start iexplore.exe http://www.seusite.com.br');

  • @Rodrigosegatto, on the client’s side? the customer clicking on the link will open the IE?

  • On the client side when it clicks on the link, it calls a function that does this: $output = shell_exec('start iexplore.exe seusite.com.br'); And yes it will open IE! :)

  • Do I test on the client? or test locally?

  • I tested it on the server now and it really doesn’t work ;(. It doesn’t open on the client screen but on the server screen. It’s not possible then?

  • Guys, sorry about the word inversion. It previously worked on the server and the client side does not work.

  • It is what is written in the answer, that it is not possible to do this, what can be done is to adapt the link(page) to work in other browsers, or customers/users be aware that it only works on IE.

  • Ok. And even using something in javascript would not work?

  • http://answall.com/questions/29286/executar-aplicativo-externo-com-javascript

  • Yeah, so there’s no way. Sorry to bother you ;(

Show 12 more comments

Browser other questions tagged

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