【发布时间】:2022-03-28 00:13:21
【问题描述】:
我试图用 javascript 打开一个带有 XMLHttpRequest 的 word 文件,但我不能。 任何人都可以帮助解决它吗? 我使用的代码是:
无题 5
<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
<html xmlns=\"http://www.w3.org/1999/xhtml\">
<head>
<meta content=\"text/html; charset=utf-8\" http-equiv=\"Content-Type\" />
<title>Untitled 5</title>
<script type=\"text/javascript\">
try{
var abreficheiro = new XMLHttpRequest();
abreficheiro.open(\'GET\', \'cir_entidade.doc\');
abreficheiro.setRequestHeader(\'Content-disposition\', \'attachment\');
abreficheiro.setRequestHeader(\'Content-type\', \'application/msword\');
abreficheiro.send();
}
catch(err) {
var strErr = \'Error:\';
strErr +=\'\\\\nNumber:\'+err.number;
strErr +=\'\\\\nDescription:\'+err.description;
document.write(strErr);
}
</script>
</head>
<body>
</body>
</html>
标签: ms-word xmlhttprequest document