我試圖在單獨的選項卡/窗口中打開.pdf文件。它的工作,但它打開兩個窗口來顯示.pdf。我使用的代碼如下。爲什麼我的代碼打開兩個窗口?
LinkButton btn = (LinkButton)(sender);
string value = btn.CommandArgument;
imfImageFile = LocalStaticData.UniImageResult;
string path = imfImageFile.WindowsPath;
if (path != "")
{
Session["OpenPDFImage"] = path;
ScriptManager.RegisterStartupScript(Parent.Page, GetType(),
Guid.NewGuid().ToString(), "openPdf(\"../InvoiceReport.aspx\");", true);
}
的JavaScript:
function openPdf(href) {
window.open(href);
}
您是否在頁面中放置了斷點?它會突破兩次嗎?這可能是一個雙重回寄麻煩? –