Add fallback option for the extension.

This commit is contained in:
Brendan Dahl 2012-05-08 13:05:33 -07:00
parent 80728f7acd
commit 982c7a0f7e
3 changed files with 51 additions and 3 deletions

View file

@ -374,6 +374,13 @@ var PDFView = {
}
},
fallback: function pdfViewDownload() {
if (!PDFJS.isFirefoxExtension)
return; // can't do this with regular viewer
var url = this.url.split('#')[0];
FirefoxCom.request('fallback', url);
},
navigateTo: function pdfViewNavigateTo(dest) {
if (typeof dest === 'string')
dest = this.destinations[dest];
@ -1352,6 +1359,9 @@ window.addEventListener('load', function webViewerLoad(evt) {
document.getElementById('fileInput').value = null;
}
if (PDFJS.isFirefoxExtension)
document.getElementById('fallback').removeAttribute('hidden');
// Special debugging flags in the hash section of the URL.
var hash = document.location.hash.substring(1);
var hashParams = PDFView.parseQueryString(hash);