i was wondering how i could do the following:
Here the user enters the details let's say the name for now
and then in the second img the text of the website changes, and when i download the second img website which doesn't hold the original js which stored the variable, it still shows the text as it might have stored the text in the file locally using js or something. [2]: https://i.stack.imgur.com/4nZCD.png
Please help me out.
In my experience, the best way to store information from page-to-page is through local storage.
Local storage persists from page to page, while JavaScript variables are cleared out, and cookies can be un-reliable based on the response from the server they are sent too.
In your function that takes the user input, write something along the lines of:
localStorage.setItem('myCat', 'Tom');
And to retrieve this information, you can reference it like:
const cat = localStorage.getItem('myCat');
Here is a reference: https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage