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