开发者

Problems to simulate download on ie

i'm doing:

iframe = document.createElement("iframe");
frame.src="http://localhost/file.csv";
iframe.style.display='none';
document.body.appe开发者_高级运维ndChild(iframe);

it works fine on ff,chrome,safari but on ie always come a message about security that blocks it.

someone knows how to fix it?


If you do not want to use jQuery which is as simple as $("result").load("file.csv"), then have a look here

http://plungjan.name/test/simpleajax.html

<html>
<head>
<title>Ajax Example</title>
<script type="text/javascript">
function xmlhttpget(URL) {
  var xmlHttpReq = (window.XMLHttpRequest)?new XMLHttpRequest():new ActiveXObject("Microsoft.XMLHTTP");
  xmlHttpReq.open('GET', URL, true);
  xmlHttpReq.onreadystatechange = function() {
    if (xmlHttpReq.readyState == 4) {
      show(xmlHttpReq.responseText);
    }
  }
  xmlHttpReq.send();
}
function show(str){
    document.getElementById("result").innerHTML = str;
}
</script>
</head>
<body>
<div id="result"></div>
<input type="button" onclick="xmlhttpget('file.csv')" value="Get">
</form>
</body>
</html>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜