ie不支持includes_IE11 – 对象不支持属性或方法“includes” – javascript window.location.hash...

我检查网址,看看它是否包含或包括?在其中控制散列在窗口中的弹出状态。所有其他浏览器没有只有IE的问题。

调试器给我这个错误时,我试图加载以这种方式对象不支持属性或方法’includes’

我得到没有错误,当我加载页面通过popstate

$(document).ready(function(e) {

if(window.location.hash) {

var hash;

if(window.location.hash.includes("?")) {

alert('I have a ?');

hash = window.location.hash.substring(window.location.hash.indexOf('#') + 0,window.location.hash.indexOf('?'));

}else {

hash = window.location.hash;

};

if (hash=="#DRS" || hash=="#DRP" || hash=="#DFFI" || hash=="#DCI" || hash=="#DCP" || hash=="#DRP" || hash=="#DRMA" || hash=="#EICS" || hash=="#ORG"){

$(hash+'Content').addClass('pageOn').removeClass('pageOff');

}else {

$('#homeContent').addClass('pageOn').removeClass('pageOff');

};

} else {

$('#homeContent').addClass('pageOn').removeClass('pageOff');

}

$(window).on('popstate', function() {

var hash;

if(window.location.hash.includes("?")) {

hash = window.location.hash.substring(window.location.hash.indexOf('#') + 0,window.location.hash.indexOf('?'));

}else {

hash = window.location.hash;

};

if (hash=="#DRS" || hash=="#DRP" || hash=="#DFFI" || hash=="#DCI" || hash=="#DCP" || hash=="#DRP" || hash=="#DRMA" || hash=="#EICS" || hash=="#ORG"){

$(this).navigate({target: $(hash+'Content')});

if(window.location.hash.includes("?")) {

}else{

location.href = location.href+'?';

}

}else {

$(this).navigate({target: $('#homeContent')});

};

});

});


版权声明:本文为weixin_30838971原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。