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 5 years, 5 months ago. Active 27 days ago. Viewed 86k times. Improve this question. Vignesh Subramanian. Forcing a link to download in this day in age should be an easy task. It is, until you have to make it cross browser compliant and have to cater for pre-HTML5 browsers.
This forces the browsers to try to download the linked file rather than trying to load it. Here is an example:. Image files like jpg, png, gif etc.
Archive files like zip, tar, gzip etc. Some file types show up in some browsers but not others depending on if the browser can read the file or not. For example, Internet Explorer IE will usually try to show Microsoft Word files doc and docx in the browser, while most other browsers will download it.
The key thing to understand is that some browsers maybe able to read a particular file type based on the addons you have installed for that browser while others may not be able to.
If a browser can read the file type it will show it in the browser. If the browser cannot read a file type it will force a download to the hard disk.
Usually this is not an issue since the users can save the file to their computer after it is shown in the browser. Some users prefer that all the files should be forced downloaded no showing in the browser.
There are a few things you can do to ensure that. Browsers cannot read zip file so it will force a download. Most computer users know to unzip the file and get the content from inside. Option 2: Most browsers have a settings where it lets the users specify if they want to force download a certain type of files for example: a pdf file. Related Posts. To make the link download you need to remove some things from the copied link Once you paste the copied link into a hyperlink or button or whatever, just remove all text after the?
Reply Is there a way to automate the creation of these links? As you might know, deploying application pages as sandboxed solutions is not possible, so the proposed answer was no solution for me.
I found out that, at least for SharePoint , there exists an application page in the Layouts-Folder called "download. After a little reflector digging, the parameter was obvious as well: just call it with the parameter "SourceUrl", like that:.
You can check it in your program. Have you fixed issue yet? Does the suggestion work for you or not? If you still show any concern on the issue, just feel free to follow up and we are glad to help with you. Best Regards,. I have resolved this issue some times back and did not checked back the thread. Today I was looking some thing else and I saw your response. Sorry about that and thanks any way.
0コメント