-1

I have two HTML files, main.html, and export.html. I also have some ajax that I wrote. I would like to store data from main.html using localStorage and then put that data into a table on export.html. Then I would like to export this HTML in an email using flask-mail. The data from main.html is in an array, so I am saving it as follows:

localStorage.setItem("firstName", data[0]);
localStorage.setItem("lastName", data[1]);

I am using flask-mail to send an email to the user which contains export.html in it. In export.html, I have a script which looks like:

document.getElementById("firstName").innerHTML = localStorage.getItem("firstName");
document.getElementById("lastName").innerHTML = localStorage.getItem("lastName");

and I have a table with td tags with those ids mentioned above. When I send the email, I put the HTML into the email, but when I check it, there is no data in the table. How can I get the data to be displayed in the email?

davidism
  • 121,510
  • 29
  • 395
  • 339
LolEb
  • 9
  • 3

1 Answers1

0

localStorage is per domain meaning that you can't actually directly access the data saved in main.html from export.html. The best way to do this is to set up a local server and send the data through there from main.html and listen for it on export.html to then display it.

Sean
  • 767
  • 1
  • 6
  • 19