a link - force Chrome to save file instead of opening - google-chrome

Is it possible to force a Chrome (and maybe other browsers) to save "mpg" file link instead of trying to open it in build-in media player via html code (and not changing settings of the browser)? I could do that via PHP with additional headers, but those files are really huge sometimes, so sending them via php wouldn't be too wise.
Before getting millions of -1s, just wanted to say that I know this is really simple question, but couldn't find an answer anywhere. Maybe it's just impossible?

There seems to be a solution with HTML 5 (download attribute):
<a href="path/to/file" download>Download Now</a>

Related

HTML downloads page rather than content

I have been working on my website and when I tried to implement a download page, it didn't seem to work
Download as JSON file
Instead of downloading data.json, it downloaded the HTML download page. When I opened the file, rather than
{
"key":"value"
}
I found the HTML contents! How can I solve this?
Things I tried
Check for any spelling mistakes - none found
Checking syntax of entire page
Possible things that might affect whats going on
I am using Vue.js Server Side Rendering
No need to specify the argument in Download.
Try With only Download.
UPDATE
This is wrong. Keeping the answer for reference. See #tony19's comment.
The download attribute takes no argument, try
<a href="data.json" download>Download as JSON file</a>

is there a place online to upload a json file and export it in html?

I have bookmarks downloaded from firefox and they are a json file.
I'm searching for a site where I can upload the json file and then download it in html format.
Does such a site exist?
THANK YOU for your kind assistance.
(Every time I do a search for this question, your site comes up.)
I don't know of a site that will do this online, but I do know of a few other ways:
You could restore them back into a Firefox profile and then export them as HTML from there, like this:
You could download and run a program like https://github.com/andreax79/json2html-bookmarks to convert them locally
You could use JavaScript to convert them in-browser, though not with an actual site, like this: Quick and dirty way to parse a mozilla firefox json file
If you need to display JSON, try with the firefox extension named jsonview.
Check out CodeBeautify, just paste and hit the Beautify button https://codebeautify.org/json-to-html-converter
There’s a lot of plugins and add ons for almost every browser out there; Firefox and especially chrome have great ones as others have mentioned, it’s worth checking out.
You are making it harder than it is. There is no JASON to HTML conversion required. Go to C:\Users\Username\AppData\Local\Google\Chrome\User Data\Default and find bookmark.file. Save it to your desktop. Uninstall the browser but also check the box that asks whether you want to keep history, etc.
Reinstall the browser, then add the bookmark.file to C:\Users\Username\AppData\Local\Google\Chrome\User Data\Default
It will overwrite the file and you have your bookmarks back. It takes about 10 minutes. No coding. No JASON to HTML conversion. Nothing.

Does HTML 5 allow to invoke save file dialog with file created in JavaScript?

Does HTML 5 allow to invoke save file dialog with file created in JavaScript?
Yes, but you don't really need HTML5 for it, what you can use is a Data URI. There are several limitations, like IE8 only allows files up to 32Kb, and you'll need to get the user to click on a link. See my answer to a similar question for an example.
In the future you may be able to use the File Writer API, but I'm not aware of any browser support for that yet.
I've tested data-uri approach. Currently it works only in Firefox.
Seems that for now it is better to stay with flash: https://github.com/dcneiner/Downloadify

Is it possible to save changes in Firebug locally?

What I'm trying to do is to save the changes I make to CSS and HTML on different sites with Firebug.
Just to be clear, I don't expect Firebug to upload the changes to the server via FTP or anything. I just want to save the changes locally, so only I will be able to see them.
For example I've seen a few Firefox/Chrome extensions that add a download button under every video on Youtube, so I know it's possible to do that somehow.
If you have a different way to achieve what I'm trying to do, I'll be glad to hear about it.
(It doesn't have to be with Firebug.)
Thanks in advance!
If you don't mind using Web Developer Toolbar it's easy to save changes made to the DOM (and CSS).
When you install the toolbar, you'll get a "View Source" menu, click on that and choose "View generated source". Then just copy and paste that into a .html file.
You did not say if you alter your HTML or CSS, if CSS, FireFile is a very good addon for this.
Edit, with some Googling, i found FireDiff, which states that it can export changes made in Firebug, i have not tested it bit it's worth checking out.
You could try using Greasemonkey.
It has support for adding custom scripts that are run whenever you load a page (linked to which pages it should load on) and that can make changes to the page dynamically.
https://addons.mozilla.org/en-US/firefox/addon/greasemonkey/
The http://chrispederick.com/work/web-developer/ web developer toolbar will let you add a user style sheet to a site which should achieve your goals.
This may or may not be exactly what you're asking for, but you can download the extension FireDiff in order to save changes made with FireBug. I made a little tutorial on how to do it here: https://www.youtube.com/watch?v=m4OmZLX2zd4
I have a somewhat simlar use-case that I solved differently. I'm not sure if it is what you are looking for or not. I'll describe the behavior and if that is helpful I'll explain exactly how I implemented it.
I changed the code that execute when you click "Run" (or Ctrl+Enter) to check to see if the first line of the code is a hard-coded string //LoadFromFile:<file path>. If it is, and the file exists then I pull the file off of the local file system and run it instead of executing the code in the console window. This way I can use an external text editor to write code.

File:// link doing nothing in all browsers

I have a link being generated that looks like so:
<a target="_blank" title="Test" href="file:///c:/test.xls">Test</a>
This link is inside an iframe.
When I click on it (in any major browser), nothing happens. Fiddler records no traffic.
Pasting the URL into the nav bar works fine - the file download box comes up, and I can download the file no problem.
I've tried every variant of the URL structure (correct and incorrect, colons, slashes, backslashes, etc.) that I can think of.
I'm certain that it's some kind of security restriction, but I can't for the life of me find out what it is or how to get around it. I'm feeling pretty foolish at this point. Any simple explanations?
Sorry, if you are pulling this page off of a server (acessing it as http://), the security settings won't let you link to local content (acess links as file://). I've had this same problem accessing shared .doc files in a wiki. Never came up with a good solution.
Try a colon instead of a pipe ;)