Search code examples
javascriptjquerycsssymbian

Detect Symbian OS devices with Javascript or CSS


I'm trying to optimize a website for Symbian OS, and I'm using media queries, however, Symbian OS doesn't recognize them, so I was wondering is there a way to detect if I'm viewing website from Symbian device and load specific CSS for it?


Solution

  • JavaScript:

    if (/SymbianOS/.test(window.navigator.userAgent)) {
        // Symbian OS specific code here
    }
    

    PHP:

    if (preg_match('/SymbianOS/', $_SERVER['HTTP_USER_AGENT'])) {
        echo '<link rel="stylesheet" type="text/css" href="symbian.css" />';
    }