Jump to content

HTML5 download attribute is not working at all on all browsers


Gamicord

Recommended Posts

I am creating a simple HTML Website on my laptop. 

So I created a simple HTML Mark up like this:
 
<img src="Will Logo.png" alt="Logo">
<a href="Will Logo.png" download>Download Image</a>

When I click the link, it doesn't download the Image, it opens it in a new window.

I have tried it on Edge, Chrome and  Firefox, and the result is the same-- the Image doesn't download. It simply opens up in a new window.

Is there some settings that I need to enable, for this HTML5 download attribute to work?

2.) When I reference this discussion from this same W3C Forum (

The person said "This might not work on the computer's local filesystem due to security restrictions in some browsers because of the same-origin policy which usually excludes the local filesystem."

Is it because I am trying to download within my Laptop, and that is why it is not working?

Does it treat the file from within my laptop as a "same origin policy that excludes my local file system"? Is this the problem?

Regards.

 

Link to comment
Share on other sites

Yes, if you opened the HTML file from your laptop that's probably the cause of the error.

You can install a local server on your laptop if you want to test these kinds of things on your laptop. WAMP or XAMPP are relatively easy to install and let your laptop act like a real server.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...