0

I am able to detect the users web browser using below function

function get_browser_name($user_agent)
{
    if (strpos($user_agent, 'Opera') || strpos($user_agent, 'OPR/')) return 'Opera';
    elseif (strpos($user_agent, 'Edge')) return 'Edge';
    elseif (strpos($user_agent, 'Chrome')) return 'Chrome';
    elseif (strpos($user_agent, 'Safari')) return 'Safari';
    elseif (strpos($user_agent, 'Firefox')) return 'Firefox';
    elseif (strpos($user_agent, 'MSIE') || strpos($user_agent, 'Trident/7')) return 'Internet Explorer';

    return 'Other';
}

To use it

$machine =  get_browser_name($_SERVER['HTTP_USER_AGENT']);

if($machine == "Internet Explorer"){

 echo "<script>

   alert('Your currently using Internet Explorer to view this page, some content will not show properly, Please use Firefox or Google Chrome.');

 </script>";

}else{

 echo "";

}

Now my next step is if lets say if firefox or Chrome is installed on the users machine script will prompt alert that asking "Do you want to open this site using firefox?", just want to know if PHP or javascript is capable on detecting if a application is installed on users machine.

1 Answer 1

2

PHP is run server side and thus cannot detect a user's installed applications.

Although JavaScript is run client-side, it also cannot, unfortunately, detect applications.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.