I am writing code to download a PDF file using window.open()
. I am passing the URL path of the pdf file on a server.
window.open(url, name, "width=910,height=750,scrollbars=yes");
I want to check if the downloading of file is successful or not. What is the return type of window.open()
?
I tried like this
try
{
window.open(url, name, "width=910,height=750,scrollbars=yes");
alert("success");
}
catch(e)
{
alert("failer");
}
When I change the URL to a wrong URL, it shows the same result as a success.
http://www.javascripter.net/faq/openinga.htm
The return value is the reference to your new window. You can use this reference later, for example, to close this window (winRef.close()), give focus to the window (winRef.focus()) or perform other window manipulations.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With