[英]Javascript file download not working on IE6 and IE7
我有以下代码
Response.TransmitFile(filePath);
使用以下代码打开新窗口
this.Page.ClientScript.RegisterStartupScript(this.GetType(), "Download", string.Format("window.open('{0}', target = 'new');", downloadURL), true);
该功能适用于IE8,但不适用于IE6和IE7
anyidea这里可能出什么问题了?
您很可能会收到脚本错误
this.Page.ClientScript.RegisterStartupScript(this.GetType(), "Download", string.Format("window.open('{0}', target = 'new');", "http://example.com"), true);
应该呈现javascript:
window.open('http://example.com', target = 'new');
在上面的脚本中,目标变量未定义。 如果您希望链接在新窗口中打开,请尝试:
this.Page.ClientScript.RegisterStartupScript(this.GetType(), "Download", string.Format("window.open('{0}', '_blank');", downloadURL), true);
在此处查找window.open函数可用参数的列表。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.