2

I have:

<a id="save-button" href="data:application/xml;charset=utf-8,your code here" download="test.cod">Save</a>

I can change the href property with:

element.href = "what I want";

but when I do

element.download = "what I want";

it doesn't work.

Does anyone know how I can change the download property?

Thanks

1
  • try element.setAttribute("download", "what I want") Commented Nov 29, 2016 at 18:50

1 Answer 1

3

The download property is not supported widely which is still an experimental API.


Use Element#setAttribute method to update an attribute.

element.setAttribute('download', "what I want");
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.