本文鏈接:https://blog.csdn.net/qq_43612658/article/details/89504751
<script>
function isIE(){
//獲取當前瀏覽器相關信息
var explorer = window.navigator.userAgent.toLowerCase() ;
//判斷是否是ie瀏覽器
if (explorer.indexOf("msie") >= 0 || explorer.indexOf("rv:11.0) like gecko") >= 0) {
return true;
}else {
false;
}
}
window.onload = function () {
if(isIE()){
//在是IE瀏覽器的情況下,對中文請求參數編碼
var str = document.getElementById("ww").href;
var str = encodeURI(str);
document.getElementById("ww").href = str;
}
};
</script>
下載excel文件遇到IE不兼容問題:實質是請求參數編碼問題
$(document).on('click','#resetBtnaa',function (){
var hygxsj=$('#hygxsj').val()
var demarcateStatus=$("#demarcateStatus option:selected").html()
var verifyStatus=$("#verifyStatus option:selected").html()
var a = document.createElement('a');
var str= '../admin/npl-website/negn/data/exportUserPage?hygxsj='+hygxsj+'&demarcateStatus='+demarcateStatus+'&verifyStatus='+verifyStatus;
str=encodeURI(str)
a.href = str;
$("body").append(a);//修復firefox中無法觸發click
a.click();
$(a).remove();
})
添加了encodeURL問題解決!!!