[removed] How to find out if the user browser is Chrome?

后端 未结 15 1752
伪装坚强ぢ
伪装坚强ぢ 2020-11-22 09:41

I need some function returning a boolean value to check if the browser is Chrome.

How do I create such functionality?

15条回答
  •  孤街浪徒
    2020-11-22 10:11

    Works for me on Chrome on Mac. Seems to be or simpler or more reliable (in case userAgent string tested) than all above.

            var isChrome = false;
            if (window.chrome && !window.opr){
                isChrome = true;
            }
            console.log(isChrome);
    

提交回复
热议问题