xp系统ie8使用embed标签,pdf不刷新,怎么才能刷新?
迎风HuA 2017-12-07 01:14:48 先上代码
js:
//刷新pdf
function doRefreshPdf(){
ajax.getPdf(function(path){
var parent=document.getElementById("pdfPid");
var pdf=document.getElementById("pdf");
parent.removeChild(pdf);
var eleme = document.createElement("embed"); //创建组件2
eleme.setAttribute("id", "pdf");
var num = Math.random();//随机数
eleme.src="${common.contentPath}"+"/scann/"+path+"?num";
eleme.style.height = "800px";
eleme.style.width = "100%";
parent.appendChild(eleme);
});
}
body:
<th id="pdfPid" rowspan="19" width="50%">
<embed width="100%" height="900px" id="pdf" src="${common.contentPath}/scann/${path}"/>
</th>
${common.contentPath}/scann/${path}是一个服务器映射路径,body里面${path}和js里面的path值是一模一样的(pdf路径是一样的,但是这两次pdf里的内容不一样)。
ajax.getPdf这是一个封装的异步方法,这个方法是没有问题的。
先删除标签,然后在添加标签,并且src加了个随机数:
1.在xp系统ie8上,pdf有刷新,pdf的内容没变;
2.在win7-64系统ie8上,pdf有刷新,pdf的内容有变。
大佬们知道是什么原因吗?有办法解决没?