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

后端 未结 15 1800
伪装坚强ぢ
伪装坚强ぢ 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:35

    User could change user agent . Try testing for webkit prefixed property in style object of body element

    if ("webkitAppearance" in document.body.style) {
      // do stuff
    }
    

提交回复
热议问题