Does HTML5 "download" attribute require any server side configuration? - html

Hell friends,
I am running a very basic example of HTML5 download attribute to download a mp3 file.
That example is working on Chrome but not working on FF (24).
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
<head>
<title>HTML5 download Attribute Example</title>
<meta name="description" value="" />
</head>
<body>
Download file
</body>
</html>
in FF it is playing that mp3 rather then downloading it.
How ever other examples of download is working on that FF from other demo sites like http://davidwalsh.name/demo/html5-download.php is working.

FireFox has a default setting to play mp3 files.
You can enter about:config in FF:s address bar to access this setting.
The setting itself is named "media.windows-media-foundation.enabled"
So in the end it's a user configuration option whether to download or play - even if FireFox makes a default decision for you. I think, in FireFox, you can "long click" to download the file instead of playing it.
Looking at the specification I think the download attribute should override the FireFox option, so if this still happends I think FireFox is not behaving the way it should.

Related

download attribute does not work in <a> tag

According to the documentation and many posts, the tag
must save a file, however for me it just opens an image in a browser: chrome, firefox, safari.
download. Prompts the user to save the linked URL instead of navigating to it.
What should I do to force downloading to a drive, without JS?
Minimum working example:
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
download
</body>
</html>
This link might be helpful . From Chrome 65+ download tag is discontinued. It is accepted only when it is from the same origin.
Problem here is, It uses JS. So, It is not completely independent of JS.

Internet explorer and edge attempt to download a file as html

I have an apache server that serves an html page with content similar to the following:
<html>
<head>
<link href="meta/style.css" rel="stylesheet" type="text/css" charset="UTF-8">
</head>
<body>
<h1>Welcome</h1>
<p><b><li>Welcome to download page</b></li>
</p>
<p>
file1.7z<br><br>
file2.7z
</p>
</body>
</html>
When I click on the file1.7z or file2.7z link, chrome starts downloading it a 7z file, but internet explorer and edge attempt to download it as html file. If I select all files in the save as dialog box and change extention to 7z, the downloaded file is a valid 7z file.
I have found out about the download attribute which will probably fix this for Edge, but it looks like Internet explorer and other browsers may not even support this.
Is there any apache server configuration I can set, or anything I can add to my html page's header, to force all browsers to download this as a 7z file?
#user13267 It sounds like you may need to add the MIME type: application/x-7z-compressed
I think you would need to do so on your server at this path:
/etc/apache2/mods-enabled/mime.conf

Make a html or xhtml page with svg displayed in local

I have a html page which have a svg. I use Chrome 54.0.2840.98 (64-bit) as web browser in Mac OS.
The svg is displayed well with localhost, whereas it is not displayed when i specify file:///Users/softtimur/... in the browser path.
I have searched some threads, some suggested to change the page to xhtml, I did it. And make the header as follows:
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
But the svg is still not shown in local.
Could anyone help?
PS: Here is the file. After downloading it, you may need to change the name test.xhtml.txt to test.xhtml.
Edit: This thread mentions that Chrome may block the access to local documents (Object in your case) from remote scripts (svg-pan-zoom). Is there a way that I rewrite the page to find a workaround? Or could I do something about Chrome settings? I really don't want to use localhost.
As Chainat and I discovered (in comments), the key is to write <script src="http://d3js.org/d3.v3.min.js"></script> (over <script src="d3js.org/d3.v3.min.js"></script>) if one wants to use external d3. Then even a html file without <html xmlns="http://www.w3.org/1999/xhtml"><meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" /> works...
First of all.
SVG's Doctype will not start with html.
svg doctype is
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
Here is the link for "Doctype's" [https://www.w3.org/QA/2002/04/valid-dtd-list.html][1].
Could you conduct another test, like opening SVG file from folder, if windows then windows explorer, by double clicking the file. It should open in your default web browser.
I have not seen this when I open my files "file:///", instead I see Drive "C:/" like this.

Direct downloading link in browser opening file instead of downloading it

I am trying to create a html simple website on IIS that will help downloading files.
<!doctype html>
<html lang="en">
<head>
</head>
<body>
Start automatic download!
</body>
</html>
This is running file. On clicking "Start automatic download!" it is downloading newUpdater.xml in browser. But, If I directly give this download link in browser (below), it is opening the XML file in all browsers(chrome, firefox).
http://169.254.68.202/newUpdater.xml
Any Idea How to fix this. I think this is possible as
http://dl.google.com//googletalk//googletalk-setup.exe
this link on browser will start downloading gtlk directly.

audio tag not working in IE9

I'm experimenting with the audio tag.
The file below does work in Google Chrome, but not in IE9. I'm always getting "audio tag not supported". I also tried wav, flac, wma --> same result.
I suspect there might some issue with the compaitibility mode, but I don't find where to change it.
Can anyone help?
Kind regards
Georg
<html>
<head>
</head>
<body>
<audio controls="controls" src="c:\concerto.mp3" >
audio tag not supported.
</audio>
</body>
</html>
Add the HTML5 doctype to the page and it should trigger standards mode in IE9. You should also add a title element to make the document valid:
<!DOCTYPE html>
<html>
<head>
<title>Add a title</title>
</head>
<body>
<audio controls="controls" src="c:\concerto.mp3" >
audio tag not supported.
</audio>
</body>
</html>
If you're still having trouble, try adding this meta tag to the head:
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
If 'audio' is working in chrome, safari, etc. but not in IE, check your meta tags. I had one that referred to IE8 which stopped the 'audio' from functioning. It was quite frustrating until I found the problem at which point the lights went on.
IE plays files in your PC if you give full path as as a URL "file://c:/concert.mp3" or only file name "concert.mp3" if the file is in the same folder as the html file. Firefox also requires full path for files in other folders while Chrome seems to add 'file://' if it is not in the URL. This is a problem if you want to use the to play local files if they are in other folders. The FileAPI does not allow you to find the path of the file.