Link opening, forcing browser choice

Odysseus13 Posted messages 5 Status Member -  
astuces72 Posted messages 2146 Registration date   Status Member Last intervention   -
Hello

The issue is as follows,

I am hosting a documentation website on a USB drive in localhost

Some browsers like Opera poorly open PDFs; I need to force the user to use Firefox or Chrome regardless of their default browser

wpserver (which is actually a local server with WordPress) can do this, and when opening the root of the site under Apache, it takes the browser from the local site

Do you know how to set this up, without of course changing the user's default browser?

Thank you

Have a nice evening

3 answers

  1. jordane45 Posted messages 30427 Registration date   Status Moderator Last intervention   4 831
     
    Hello,
    You cannot "choose" the browser that will open the page... but you can code (in PHP or JAVASCRIPT) to detect the browser used... and accordingly... display a message indicating to use another one...

    In JavaScript, for example:
    https://www.xul.fr/ecmascript/navigator.php
    or better... in Jquery: https://github.com/gabceb/jquery-browser-plugin

    In PHP, you can use the Browser class
    https://github.com/cbschuld/Browser.php

    --
    Best regards,
    Jordane
    1