Hi.
Say i have
- a webpage with an iframe:
- an url pointing to a pdf document: http://www.example.com
- some javascript that will do iframe.src=pdfurl
a button that will trigger such javascript
if the browser is going to display the pdf inline, the button will say "view pdf" and when clicked will make the iframe visible
otherwise it will say "download pdf"
I found a way to detect wether the pdf has been loaded in the iframe: reading iframe.contentDocument.contentType after onload has fired, but
- this won't allow me to display the correct button
- onload does not fire if the file is being downloaded
Thanks :)