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?

有帮助吗?

解决方案

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" />';
}

其他提示

I haven't tried it, but this could work. It enables media queries in browsers that don't support them natively.

https://github.com/scottjehl/Respond
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top