Is there any solution in javascript which can be used to determine if pdf file exists on a given external url?
object
tag supports onerror event only in firefox but not in chrome/safari/edge.
I've tried with attaching href
to link
tag but that won't work if test from https
to http
The idea is to display pdf in object tag if url is valid (file exists), otherwise a custom error should be displayed
PS Ajax call doesn't work because of cors
EDIT
<object onerror="alert('error')" id="myPdf" type="application/pdf" data="https://tech.ebu.ch/docs/tech/tech3285X.pdf">
Unable to open the PDF file.
</object>
onerror
will be triggered in Firefox but not in Chrome