HTML5 download attribute not changing filename - html

I'm having issues with the download attribute and overwriting the filename. Currently when I set a value for the download attribute it is not taking affect. I believe this as something to do with the specific file I am referencing as it works for other files, but I'm not sure exactly what is causing the issue or how to resolve.
In the below code the filename does not get overridden. (I stole the code straight from W3Schools to keep the example very basic and to ensure nothing I am doing is creating the issue.)
Additional, the download only works in Chrome. If you try in Firefox it opens the file to play the video (which is another issue that I need to resolve).
<a href="https://cameratag.com/videos/v-c1e97800-8f2b-0132-12e6-22000a8c0328/qvga/mp4.mp4" download="w3logo22">
<img border="0" src="/images/myw3schoolsimage.jpg" alt="W3Schools" width="104" height="142">
</a>

Resolved, I contacted the content provider and determined the issue is due to the fact the assets URLs are actually redirects to a signed URL on their CDN.

Related

Can't download file using HTML5 download attribute

I'm trying to create a download link the way it always worked for me. But now it keeps redirecting me to Google Docs – I've never experienced that before, this should be a straight-forward task to do, so it quite shocked me.
I use the HTML5 download attribute:
<a href="../files/uploads/myfile.docx" download>myfile.docx</a>
But I always end up redirected to Google Docs. I also opened the Chrome dev console and noticed that after I click on the link, it changes the href to Google Docs. I have no clue why.
The path should be alright, I can't figure out the problem. What shall I do?
The download attribute only works for same-originl URLs. So if the href is not the same origin as the site, it won't work. In other words, you can only download files that belongs to that website. This attribute follows the same rules outline in the same-origin policy

How to download the audio file instead of streaming [duplicate]

As the title says, I'd like to download a mp3-file instead of playing it in Firefox.
I do it like this:
<a href="http://test.com/path/to/my/file.mp3" download></html>
In all other browsers the file is downloaded, only Firefox starts playing the audio file instead of asking me if I would like to save it to my hard disk.
Write this
<a href="http://test.com/path/to/my/file.mp3" download></html> WRONG
should be
download
Tested 8/18, Firefox correctly handles a simple download attribute. The accepted and second-ranked answers are wrong, at least as of now.
So, simply,
<a href="http://test.com/path/to/my/file.mp3" download></a>
will work, and if you want to control what the file is downloaded as, you give download a value:
That is why Chrome (or any modern browser) will download it as "true.mp3" if you try to use download="true" instead of a simple download to force the file download.
Also, note that <a></html> in the question isn't valid, and could have possibly caused a problem at the time if that's not just a typo.
I used <a href="http://test.com/path/to/my/file.mp3" download >download</a>
If you use the download="true" inside the anchor This will result in the renaming of the file name to true.mp3 in chrome an firefox as mention above.
This is the correct way to force the download:
download
NB: it will work on Firefox only if the file is located on the same domain unfortunately, cf. https://bugzilla.mozilla.org/show_bug.cgi?id=874009

Force download instead of streaming of mp3 file in FF

As the title says, I'd like to download a mp3-file instead of playing it in Firefox.
I do it like this:
<a href="http://test.com/path/to/my/file.mp3" download></html>
In all other browsers the file is downloaded, only Firefox starts playing the audio file instead of asking me if I would like to save it to my hard disk.
Write this
<a href="http://test.com/path/to/my/file.mp3" download></html> WRONG
should be
download
Tested 8/18, Firefox correctly handles a simple download attribute. The accepted and second-ranked answers are wrong, at least as of now.
So, simply,
<a href="http://test.com/path/to/my/file.mp3" download></a>
will work, and if you want to control what the file is downloaded as, you give download a value:
That is why Chrome (or any modern browser) will download it as "true.mp3" if you try to use download="true" instead of a simple download to force the file download.
Also, note that <a></html> in the question isn't valid, and could have possibly caused a problem at the time if that's not just a typo.
I used <a href="http://test.com/path/to/my/file.mp3" download >download</a>
If you use the download="true" inside the anchor This will result in the renaming of the file name to true.mp3 in chrome an firefox as mention above.
This is the correct way to force the download:
download
NB: it will work on Firefox only if the file is located on the same domain unfortunately, cf. https://bugzilla.mozilla.org/show_bug.cgi?id=874009

Trying to open a .pdf file in an iframe

I am really having a hard time opening up certain .pdf files within an iframe HTML element. I can open some .pdf files in this iframe, but not all of them. The ones that I cannot open were created by the Crystal Reports engine in Visual Studio 2010.
My source is simple and looks like the following:
<iframe src= "c:\jnk\EULA.pdf">
</iframe>
Is there any characteristic of a .pdf file that could prevent it from being displayed in an iframe? I am using IE8, but get the same results in FF. I also can perfectly display this .pdf file when it is not in an iframe.
IFrame isn't correct solution. You can use other solutions :
1 . <embed src="file:///C:\jnk\EULA.pdf" width="500" height="375">
2 . Download this library and use it.
I hope that I helped.
PS
Remember that when we use local file, we should write in prefix file:///
Sorry for my English
Based on a comment of yours, it sounds like your issue is one of permissions, unrelated to PDFs.
If I were you, I'd make sure that I can access the PDFs in my browser outside of any HTML. If that fails, you know you have a problem.

Mozilla unable to display images whereas IE does

Could anyone tell me why mozilla firefox unable to display the images where explorer can do? I even changed the extension with CAPs in all ways i can but not yet working. I have written a HTML file and my IE can open in the way i want but when i open my HTML file using the mozilla it is not displaying images but just leaving the image borders.
And also IE can reference to the CSS sheet path and making the changes but wheareas the mozilla its unable to link with css sheet path I have set the text color and font size in my css sheet and linked it with my html file. Its working perfect in IExplorer but not with the mozilla. I have been asking these thing How do i make a standard HTMl file that works on every browser And i got some answers from you but still I am unable to make it work .Can anyone tell me a good document to go through because no matter how i try its working on one browser and throwing the error on some other browser
Im giving it as src="d:\text\image.png"
If you are using absolute paths with drive letters, e.g. <img src="C:\www\images\foo.png" alt="foo">, it will work with Internet Explorer but not with Firefox. If you include drive-letters etc. in the path, the path becomes Windows specific, something that IE can understand but other browsers may not.
To fix the problem, you should use relative paths, e.g. <img src="images\foo.png" alt="foo">. The path should be relative to the HTML file where this code is present.
Most often, web pages are written to be hosted on web servers. Images are usually put under an 'images' directory inside the document root (web-root), say, /images/foo.png. Now, the home page at /index.html can include this image either using a relative path: <img src="images/foo.png" alt="foo"> or an absolute path (path from the document root): <img src="/images/foo.png" alt="foo">. Note the usage of forward-slash as opposed to back-slash. You should use forward-slash. Back-slash is very Windows specific and other browsers may not understand it.
The same applies for CSS or any other paths used in your HTML documents.
For me worked (for Mozilla Firefox v 26.0).
<img src="file///C:/User/MrBrown/www/images/foo.jpg">
Didn't worked:
<img src="C:\User\MrBrown\www\images\foo.jpg">
instead of specifying the path as src="d:\text\image.png"...
change the path as src="file:///D:/text/image.png"
if the folder name are having spaces.. then instead of spaces, write %20. or else open that image file in any of the web browser.. and copy the address from the address bar and paste that address as src path..
it will work for both Google chrome and firefox..