That is, if you grab it using HTTP. If it's on your local filesystem, you could use the file URI scheme. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams?
Collectives on Stack Overflow. Learn more. Asked 9 years, 8 months ago. Active 7 months ago. Viewed 77k times. I have a very simple pure html file in which I have many PDF files. Improve this question. Madara's Ghost k 49 49 gold badges silver badges bronze badges.
Seems this is a known problem for Chrome. Are you seeing the same problems elsewhere too? As long as you have the ability to edit the HTML code of the page, you can use a simple HTML tweak that will allow you to control when the file download prompt appears if the user clicks a link or a button. In some cases, the name of the file that is stored on the web server is not the most useful to the user. As of this post, all major desktop browsers excluding Microsoft IE support the download attribute.
It is likely that people who use these browsers would likely rather view the document rather than saving it to their phone. If no programs will open the HTML file, you can ask software developers for help.
See the chart below to find the developers for the most common programs used to open HTML files. A universal file viewer, like File Magic Download , is a tool that you can use to open a file when no other program will work.
They can open many different file types, depending on the format. I agree, and think Sarim's answer is good it probably should be the chosen answer if the OP ever returns. While the download attribute has gained support, it's still spotty:.
This goes for ASP. I am sure you can find similar solutions in all other server side languages. However there's no javascript solution to the best of my knowledge. When you want to direct download any image or pdf file from browser instead on opening it in new tab then in javascript you should set value to download attribute of create dynamic link. Appending child and removing child is useful for Firefox, Internet explorer browser only. On chrome it will work without appending and removing child.
You can use download. If the file is in an external URL, you must make an Ajax request, but if it is not, then you can use the function:. The solution that worked best for me was the one written up by Nick on his blog.
The basic idea of his solution is to use the Apache servers header mod and edit the. While this doesn't actually involve editing HTML as per the original question it doesn't require any programming per se.
The first reason I preferred Nick's approach is because it allowed me to set it on a per folder basis so PDF's in one folder could still be opened in the browser while allowing others the ones we would like users to edit and then re-upload to be forced as downloads.
The second reason was because time is a consideration. Writing a PHP file handler to force the content disposition in the header will also take less time than an API, but still longer than Nick's approach. If you know how to turn on an Apache mod and edit the. It requires Linux hosting not Windows. This may not be appropriate approach for all uses as it requires high level server access to configure.
As such, if you have said access it's probably because you already know how to do those two things. If not, check Nick's blog for more instructions. As the html5 way my previous answer is not available in all browsers, heres another slightly hack way.
Your description is too vague to understand what is really happening, and since I don't use DropBox, I can't say I feel the pain, either. Apparently the team uses a vendor who creates these 'packages' and then has the team review the html file. No real way to have them change it. Similar concept we used in SharePoint when we uploaded training videos. Users clicked on the html file and all the content was tied to it. Layout below - must be able to open html. Thought there might be a setting somewhere.
This is not an option, the file is shared via direct link. No renaming can happen. No one is visiting the site at all. Just viewing a file to approve a training session.
0コメント