0

I have a first HTML page, where I do a drag and drop and put the file got with the drag and drop, on the firebase storage. When I finished the drag and drop and the sending of the files to the firebase storage, I have created a double array, where I put all the information that I need, so, the name of each files and their downdoable link aswell.

And I need to re-use this same array, on a second HTML page. How can I do it?

Zoe
  • 27,060
  • 21
  • 118
  • 148
Zahreddine Laidi
  • 560
  • 1
  • 7
  • 20
  • We would need waaaaay more information to give a relevant answer, it would also be worth including a minimal example of what you have so far. – DBS Oct 04 '18 at 13:00
  • 2
    Try to save it in LocalStorage on the First page and retrieve it on the Second. – Ivan Burnaev Oct 04 '18 at 13:01
  • I hope it helps , https://stackoverflow.com/questions/3357553/how-do-i-store-an-array-in-localstorage – Anjan Kumar GJ Oct 04 '18 at 13:07
  • I understood how it works, but how can i use this localstorage in a differant JS file ?? :( @AnjanKumarGJ – Zahreddine Laidi Oct 04 '18 at 13:09
  • I just tried this tutorial https://www.c-sharpcorner.com/blogs/get-and-set-variable-values-from-one-javascript-file-to-another-javascript-file-using-local-storage but i already get null on my variable on the b.js file.... ;( @IvanBurnaev – Zahreddine Laidi Oct 04 '18 at 13:17
  • It doesn't matter whether you are in same file or in different file if you are using localstorage – Gangadhar Jannu Oct 04 '18 at 13:42
  • is your first page and second page are in same domain? If yes you can go ahead with local storage – Gangadhar Jannu Oct 04 '18 at 13:43
  • i think yes, this is two differant html file but they are located in the localhsot @GangadharJannu – Zahreddine Laidi Oct 04 '18 at 13:48
  • 1
    Set: `sessionStorage.setItem("array", yourArray);` Retrieve: `sessionStorage.getItem("array");` link: https://www.w3schools.com/jsref/prop_win_sessionstorage.asp – Si8 Oct 04 '18 at 13:54

1 Answers1

1

You can use sessionStorage

Set:

sessionStorage.setItem("array", yourArray);

Retrieve:

sessionStorage.getItem("array");

link: w3schools.com/jsref/prop_win_sessionstorage.asp

Si8
  • 9,141
  • 22
  • 109
  • 221