When I run window.open(file, "download") with safari, it opens a blank page while download prompt and the blank page stays开发者_运维知识库 there. I notice firefox opens a blank tab but it's close when download starts. Is there another javascript command/function that will work so there's no blank page opened in Safari?
Why don't you use window.location = file
instead?
Redirecting to the file leads to the same behavior as clicking on a link to that file: you get the download prompt, and the browser stays on the current page!
Call window.open
like this (it works in all major browsers):
window.open(file, '_parent', 'download');
精彩评论