1

I have 2 pages and I am trying to navigate from page 2 to page 1. Is there any option to bind object from page 2 to page 1 element with plain javascript?

The below is the basic algorithm I am trying. I am trying to check if that is possible or not and implement based on some pointers.

Page 1 code

<div id="page1Element">
</div>

Page 2 code Go Back

<script>
    goBack();
    function goBack() {
        var obj = {some object values};
        document.getElementById("page1Element").innerHTML = obj.value;
        window.history.back();
    }

</script>
Kurkula
  • 6,386
  • 27
  • 127
  • 202
  • Possible duplicate of [passing form data to another HTML page](https://stackoverflow.com/questions/14693758/passing-form-data-to-another-html-page) – zero298 Jan 10 '18 at 21:39

2 Answers2

1

If these are totally different pages and both are loaded by hitting the server then you have the following options:

  1. Send all the data to the server and have the new page render using that data.
  2. Save the data in localStorage and have the new page read that data out of localStorage
Intervalia
  • 10,248
  • 2
  • 30
  • 60
0

You can store the data in your browser localstorage and access it in page 2.

Praveen Alluri
  • 307
  • 2
  • 14