web: Fix detecting mobile browsers for NodeJS

This commit is contained in:
Hajime Hoshi 2018-05-16 22:29:19 +09:00
parent a5eb1b84ab
commit 0637a812bc

View File

@ -40,6 +40,9 @@ func IsBrowser() bool {
} }
func IsIOSSafari() bool { func IsIOSSafari() bool {
if IsNodeJS() {
return false
}
ua := js.Global.Get("navigator").Get("userAgent").String() ua := js.Global.Get("navigator").Get("userAgent").String()
if !strings.Contains(ua, "iPhone") { if !strings.Contains(ua, "iPhone") {
return false return false
@ -48,6 +51,9 @@ func IsIOSSafari() bool {
} }
func IsAndroidChrome() bool { func IsAndroidChrome() bool {
if IsNodeJS() {
return false
}
ua := js.Global.Get("navigator").Get("userAgent").String() ua := js.Global.Get("navigator").Get("userAgent").String()
if !strings.Contains(ua, "Android") { if !strings.Contains(ua, "Android") {
return false return false