Clicking a download link in Safari causes all target=_blank links to download when clicked, is there a workaround?

后端 未结 2 612
隐瞒了意图╮
隐瞒了意图╮ 2021-02-15 17:53

Issue: After clicking on a link that downloads content, all other links that have target=\"_blank\" and no download attr download when clicked instead of openin

2条回答
  •  北荒
    北荒 (楼主)
    2021-02-15 18:47

    With regards to your issue mention above, you have a couple of option to download a file:

    Open file in same window:

    Click to Download
    

    Open file in new window:

    Click to Download
    

    Force file download window:
    However, if you want to force the file to download, by prompting a download pop-up box (to open or save), then all you need to do is add ‘download’ to the link as seen below:

    Click to Download
    

    Therefore, your edited code could look something like this:

    
    
    
      
        
        
      
    
      
        

    Instructions

    • Click ME (download NOT present) to see page load in new tab then come back to this page
    • Click ME (download PRESENT) to see it downloaded
    • Click ME (download NOT present). Safari forces this link to download

    Hope this helps you!

提交回复
热议问题