mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-02-08 00:21:11 +01:00
91 lines
3.1 KiB
JavaScript
91 lines
3.1 KiB
JavaScript
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* Copyright 2013 Mozilla Foundation
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
/* globals URL, PDFJS */
|
|
|
|
'use strict';
|
|
|
|
var DownloadManager = (function DownloadManagerClosure() {
|
|
|
|
function download(blobUrl, filename) {
|
|
var a = document.createElement('a');
|
|
if (a.click) {
|
|
// Use a.click() if available. Otherwise, Chrome might show
|
|
// "Unsafe JavaScript attempt to initiate a navigation change
|
|
// for frame with URL" and not open the PDF at all.
|
|
// Supported by (not mentioned = untested):
|
|
// - Firefox 6 - 19 (4- does not support a.click, 5 ignores a.click)
|
|
// - Chrome 19 - 26 (18- does not support a.click)
|
|
// - Opera 9 - 12.15
|
|
// - Internet Explorer 6 - 10
|
|
// - Safari 6 (5.1- does not support 77a5576f51465e13a686f6e"> |