Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to detect samsung stock browser

Because the canvas bug of samsung stock browser, my program will cause error. (http://code.google.com/p/android/issues/detail?id=39247)

So I want to disable canvas on all Samsung stock browser.

Could I detect it by navigator object or other way?

I found the same question, but it's solution looks like not perfect (javascript - regex matching devices on user agent)

Wiki shows Samsung has more models. (http://en.wikipedia.org/wiki/Samsung_Galaxy_S_III)

like image 378
Sam Avatar asked Feb 19 '13 02:02

Sam


2 Answers

The following regex covers almost all Samsung mobile devices.

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...
}
like image 156
Anulal S Avatar answered Oct 25 '22 03:10

Anulal S


You can simply do this

var isSamsungBrowser = navigator.userAgent.match(/SamsungBrowser/i)
like image 22
imal hasaranga perera Avatar answered Oct 25 '22 03:10

imal hasaranga perera