Skip to content

Commit

Permalink
Fix Safari 9
Browse files Browse the repository at this point in the history
  • Loading branch information
msokk committed Jan 21, 2016
1 parent f3c963e commit cfbfddb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions download.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,9 @@
return true;
}

if(typeof safari !=="undefined" ){ // handle non-a[download] safari as best we can:
url="data:"+url.replace(/^data:([\w\/\-\+]+)/, u);
// handle non-a[download] safari as best we can:
if(/(Version)\/(\d+)\.(\d+)(?:\.(\d+))?.*Safari\//.test(navigator.userAgent)) {
url=url.replace(/^data:([\w\/\-\+]+)/, u);
if(!window.open(url)){ // popup blocked, offer direct download:
if(confirm("Displaying New Document\n\nUse Save As... to download, then click back to return to this page.")){ location.href=url; }
}
Expand Down

0 comments on commit cfbfddb

Please sign in to comment.