Using `[removed].hash.includes` throws “Object doesn't support property or method 'includes'” in IE11

后端 未结 8 730
生来不讨喜
生来不讨喜 2021-01-30 11:58

I am checking the URL to see if it contains or includes a ? in it to control the hash pop state in the window. All other browsers aren’t having an issue, only IE.

8条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-30 12:55

    I'm using ReactJs and used import 'core-js/es6/string'; at the start of index.js to solve my problem.

    I'm also using import 'react-app-polyfill/ie11'; to support running React in IE11.

    react-app-polyfill

    This package includes polyfills for various browsers. It includes minimum requirements and commonly used language features used by Create React App projects.

    https://github.com/facebook/create-react-app/blob/master/packages/react-app-polyfill/README.md

提交回复
热议问题