Browser Detection in ReactJS

前端 未结 7 1736
甜味超标
甜味超标 2020-12-04 22:20

Is there any way to detect IE browser with React and either redirect to a page or give any helpful message. I found something in JavaScript, but not sure how would I use it

7条回答
  •  悲&欢浪女
    2020-12-04 23:02

    This is the service I always use when doing JS/Browser based browser-detection: http://is.js.org/

    if (is.ie() || is.edge()) {
      window.location.href = 'http://example.com';
    }
    

提交回复
热议问题