in javascript how can I detect if a browser will display or download a pdf?
<p>Say i have</p>

<ul>
<li>a webpage with an iframe: </li>
<li>an url pointing to a pdf document: <a href="http://www.example.com" rel="nofollow">http://www.example.com</a></li>
<li>some javascript that will do iframe.src=pdfurl</li>
<li><p>a button that will trigger such javascript</p>

<ul>
<li><p>if the browser is going to display the pdf inline, the button will
say "view pdf" and when clicked will make the iframe visible</p></li>
<li><p>otherwise it will say "download pdf"</p></li>
</ul></li>
</ul>

<p>I found a way to detect wether the pdf has been loaded in the iframe: reading iframe.contentDocument.contentType after onload has fired, but </p>

<ul>
<li>this won't allow me to display the correct button</li>
<li>onload does not fire if the file is being downloaded</li>
</ul>

<p>Thanks :)</p>
