是否有可能检测到三星股票浏览器

Sam*_*Sam 8 javascript canvas navigator android-browser

因为三星股票浏览器的画布bug,我的程序会导致错误.(http://code.google.com/p/android/issues/detail?id=39247)

所以我想在所有三星股票浏览器上禁用画布.

我可以通过导航器对象或其他方式检测到它吗?

我发现了同样的问题,但它的解决方案看起来并不完美(javascript - 用户代理上的正则表达式匹配设备)

Wiki显示三星拥有更多型号.(http://en.wikipedia.org/wiki/Samsung_Galaxy_S_III)

Anu*_*l S 5

以下正则表达式涵盖了几乎所有三星移动设备。

if(navigator.userAgent.match(/SAMSUNG|Samsung|SGH-[I|N|T]|GT-[I|N]|SM-[A|N|P|T|Z]|SHV-E|SCH-[I|J|R|S]|SPH-L/i)) {
    console.log("it's Samsung");
    // your code for Samsung Smartphones goes here...
}
Run Code Online (Sandbox Code Playgroud)


ima*_*era 5

你可以这么做

var isSamsungBrowser = navigator.userAgent.match(/SamsungBrowser/i)
Run Code Online (Sandbox Code Playgroud)


Sim*_*ris 1

使用 userAgent 足以检测此错误。寻找字符串534.30。例如:

  if (window.navigator && window.navigator.userAgent.indexOf('534.30') > 0) {
    // Clear the canvas a different way because they are using a known-bad version of the default android browser
  }
Run Code Online (Sandbox Code Playgroud)