E
E
Egor Tisnoy2014-12-12 13:49:37
Browsers
Egor Tisnoy, 2014-12-12 13:49:37

How to implement browser detection script?

Interested in the same functionality as on 2ip.ru , where the exact version of the browser is determined.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
G
Gregory, 2014-12-12
@difiso

Isn't it?

E
Evervess, 2014-12-12
@Evervess

I am using this function:

function get_user_browser() {
    preg_match("/(Opera|Firefox|Chrome|Chromium|Safari|MSIE)[\s\/]?([0-9]+)/", $_SERVER['HTTP_USER_AGENT'], $browser_info);
    $browser = array();
    $browser['name'] = !empty($browser_info[1]) ? $browser_info[1] : null;
    $browser['version'] = !empty($browser_info[2]) ? $browser_info[2] : null;
    return $browser;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question