HTML downloads page rather than content

Viewed 33

I have been working on my website and when I tried to implement a download page, it didn't seem to work

<a href="data.json" download="data.json">Download as JSON file</a>

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
2 Answers

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>

No need to specify the argument in Download. Try With only Download.

Related