我正在編寫使用window.open()
下載PDF文件的代碼。我在服務器上傳遞pdf文件的URL路徑。JavaScript中的window.open()的返回類型是什麼
window.open(url, name, "width=910,height=750,scrollbars=yes");
我想檢查文件的下載是否成功。 window.open()
的退貨類型是什麼?
我試過這樣
try
{
window.open(url, name, "width=910,height=750,scrollbars=yes");
alert("success");
}
catch(e)
{
alert("failer");
}
當我更改URL到錯誤的URL,它顯示了同樣的結果是成功的。
你不檢查任何返回值。 'open()'返回'window reference'或'null'。 – jAndy