How to force chrome to download a file
Chrome v56 no longer allows the built-in viewer to completely disabled. This is NOT what I want. Save the file; do NOT open the file. FWIW - my download setting in Chrome points to the top-level directory in my Download folder and the check box "Ask where to save download file" is ticked.
Is there any way to persuade Chrome to revert back to previous behavior and just download the file to local storage? Not sure exactly when this was changed.
In version 58 there is a similar option to Open PDF files in the default viewer, but this has the same effect in linux possibly different on other platforms. Some servers may include Content-Disposition: attachment header in their response leading to Chrome downloading the file when you click on the download link while others may skip that header in their response, leaving the decision of whether to open or download the file up to Chrome.
The following solution will download all PDF files including embedded files meant to be viewed within Chrome like the one's here and here. However, it won't work for sites using PDF. You can achieve this with the Modify Content-Type extension. Sign up to join this community. The best answers are voted up and rise to the top. Stack Overflow for Teams — Collaborate and share knowledge with a private group.
Create a free Team What is Teams? Learn more. Asked 4 years, 7 months ago. If for whatever reason, you cannot add the download attribute in the case that you cannot directly edit the HTML of your web page , you can optionally compress the file using zip, and instruct the user to download the zip file.
You can alternatively explain to the user that they should right click on the link and select download. If you have no other alternatives to force the file to download, you can host it on a file hosting service such as Google Docs. The most common file types that are affected by this behavior are PDF files and images. The code below will tell the browser to prompt the user to save the file. Browse All Buying Guides. Best iPhone 13 Pro Case. Best Bluetooth Headphones for Switch.
Best Roku TV. Best Apple Watch. Best iPad Cases. Best Portable Monitors. Best Gaming Keyboards. Best Drones. Best 4K TVs. Best iPhone 13 Cases. Best Tech Gifts for Kids Aged Awesome PC Accessories. Best Linux Laptops. Best Bluetooth Trackers. Best eReaders.
Best Gaming Monitors. Best Android Phones. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown.
The Overflow Blog. Podcast what if you could invest in your favorite developer? Who owns this outage? Building intelligent escalation chains for modern SRE.
0コメント