【发布时间】:2013-03-14 16:23:38
【问题描述】:
当我使用 URL 使用 Internet Explorer 从我的服务器下载 Excel 文件时遇到问题。
我的 PHP 脚本中有以下代码
echo "<script>
window.location='http://localhost/complaint/export/export_complaint.xls';
</script>";
当我使用 Chrome 作为浏览器时,此脚本可以创建自动下载操作,但在 Internet Explorer 中不起作用。
我使用的是 Internet Explorer 9。
如果对此问题有任何建议,请告知。非常感谢!
【问题讨论】:
-
将
type="text/javascript"属性添加到script标签 -
感谢@Ander2,当我下载 Excel 2003 格式时它可以工作,但对于 Excel 2007 格式仍然失败
-
@user1875301 检查我的答案,它可以使用
jQuery下载文件
标签: php javascript excel internet-explorer