IE8 兼容性问题总结
使用背景
- 开发工具是 IntelliJ IDEA 开发工具
- 电脑上必须安装 VMware Workstation 虚拟机
- 虚拟机中需要安装win 7 操作系统,使用win7 默认浏览器就是IE8
常见问题
1) URL 请求失效问题
原因分析:
IE8 打开地址的时候,把地址缓存了,如果再次请求的时候,会使用缓存的地址,就不会进行请求操作
处理方式:
通过在请求地址后面加时间来控制:
示例:
`url: httphost+"/cusaddb/userlist?"+new Date().getTime(),
type: "get",
dataType: "json",
data:{
departId:selectDepartId,
searchParmStr:searchParmStr,
pageIndex:pageIndex,
pageSize:pageSize
},`
2)中文文件导出操作提示404错误
背景:
IE8 下英文导出可以,中文导出提示404
处理方式:
把输入内容转码:转码方法是把内容包括在encodeURIComponent 方法中。
示例:
var url = httphost + '/cusaddb/userListExp?'+'departId=&searchParmStr='+encodeURIComponent(searchParmStr);
//window.location.href = url;
openFileClick(url);
function openFileClick(href) {
var a = document.createElement('a');
a.setAttribute('href', href);
a.setAttribute('id', 'startTelMedicine');
// 防止反复添加
if (document.getElementById('startTelMedicine')) {
document.body.removeChild(document.getElementById('startTelMedicine'));
}
document.body.appendChild(a);
a.click();
}
3)需要删除console.log()
4)分辨率不适配问题
需要依据具体的分辨率来解决
@media screen and (max-width: 1200px){
.address-tit-search{
width: 220px;
}
.address-tit-search input{
width: 124px;
}
.address-user-items{
width: 220px;
}
.fixed-table-container table {
width: 70%;
}
.address-branch-wrap{
width: 980px;
}
}
@media screen and (min-width: 1200px){
.address-tit-search{
width: 280px;
}
.address-tit-search input{
width: 193px;
}
.address-user-items{
width: 280px;
}
.fixed-table-container table {
width: 100%;
}
.address-branch-wrap{
width: 920px;
}
}
IE8 下插件使用
1)文件附件上传
目前找到的解决方式是使用:WebUpload 这个组件
2)IE8 下前端框架问题
3)隐藏控件的使用
隐藏控件不能直接在input 里增加hidden ,需要设置type=hidden
IE8 不兼容属性
1)unset 属性:不设置样式信息