0

我有以下代码JavaScript文件下载不工作的IE6和IE7

Response.TransmitFile(filePath); 

打开使用的代码

this.Page.ClientScript.RegisterStartupScript(this.GetType(), "Download", string.Format("window.open('{0}', target = 'new');", downloadURL), true); 

这适用于IE8下面一行但不工作的新窗口在IE6和IE7上

anyidea这里可能有什么问题?

+1

什么JavaScript命令做这个结果吗? – 2010-10-21 19:59:24

+0

window.open并且窗口正在关闭。所以我没有JavaScript。 – kalls 2010-10-21 20:13:00

回答

0

你很可能得到一个脚本错误

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); 

here为可用参数列表给window.open功能

+0

IE6和IE7如何? – kalls 2010-10-22 01:13:16