Send data to another page - html : <p>Hello I wanted to send data from one html page to another </p>

<p>For eg this is my index.html page</p>

<pre><code>&lt;html&gt;
    &lt;body&gt;
        &lt;script&gt;
            var uname = "karan"; // I want to send this
        &lt;/script&gt;
    &lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>And this is newPage.html:</p>

<pre><code>&lt;html&gt;
    &lt;body&gt;
        &lt;script&gt;
            console.log(uname); // I want the uname form index.html
        &lt;/script&gt;
    &lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>I have already tried declaring a new class in another javascript file but it gives <code>undefined</code></p>

<p>Is there any way I can do this? Thank you</p>
