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

后端 未结 8 876
生来不讨喜
生来不讨喜 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:50

    As in Internet Explorer, the javascript method "includes" doesn't support which is leading to the error as below

    dijit.form.FilteringSelect TypeError: Object doesn't support property or method 'includes'

    So I have changed the JavaScript string method from "includes" to "indexOf" as below

    //str1 doesn't match str2 w.r.t index, so it will try to add object
    var str1="acd", str2="b";
    if(str1.indexOf(str2) == -1) 
    {
      alert("add object");
    }
    else 
    {
     alert("object not added");
    }
    

提交回复
热议问题