Skip to content


Subversion checkout URL

You can clone with
Download ZIP


UserAgentParser.php: use actual IE version instead IE7 when in compatibility mode #2621

anonymous-piwik-user opened this Issue · 4 comments

2 participants


all of our IE8 are detected as IE7 in UserAgents because they are running in compatibility mode. it would be nice to have those browsers recodgnised as "IE8 Compatibility" and not as IE7. i have patched UserAgentParser.php

        // Misbehaving IE add-ons
        $userAgent = preg_replace('/[; ]Mozilla\/[0-9.]+ \([^)]+\)/', '', $userAgent);
// IE 8 in compatibility mode on xp, vista and win7
        $userAgent = preg_replace('/MSIE 7.0; Windows NT 5.1; Trident\/4.0/', 'MSIE 8.0; Windows NT 5.1; Trident/4.0', $userAgent);
        $userAgent = preg_replace('/MSIE 7.0; Windows NT 6.0; Trident\/4.0/', 'MSIE 8.0; Windows NT 6.0; Trident/4.0', $userAgent);
        $userAgent = preg_replace('/MSIE 7.0; Windows NT 6.1; Trident\/4.0/', 'MSIE 8.0; Windows NT 6.0; Trident/4.0', $userAgent);

i also patched UserAgentParser.test.php to have ie8 on winxp

    'ie8 on vista' => 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0)',
    'ie8 on winxp' => 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; ',

so with this IE8 as returned. maybe it would be better to return it as "IE8 in Compatibility Mode".



(In [5105]) fixes #2621 but UserAgentParser could use some love


Hello @Markus!

Unfortunately this problem still persists in the latest version (1.12). On an intranet (my case) the Browser Version report is useless this way.

I tried using your patch, but I got no success... Please, could you post a new patch?


Please open a new ticket with the User Agent that's failing.

tests/PHPUnit/Plugins/UserSettingsTest.php contains compatibility mode User Agent strings showing the actual browser version is detected (instead of the reported compatibility mode).


I'll do it. Thank you for putting me in the right direction.

Sorry for the noise!

@anonymous-piwik-user anonymous-piwik-user added this to the 1.6 Piwik 1.6 milestone
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.