Try this code:
In testing.html
<script>
function testJS() {
var b = document.getElementById('name').value,
url="http://path_to_your_html_files/next.html?name=" + encodeURIComponent(b);
document.location.href = url;
}
</script>
And in next.html:
<script>
window.onload = function () {
var url = document.location.href,
params = url.split('?')[1].split('&'),
data = {}, tmp;
for (var i = 0, l = params.length; i < l; i++) {
tmp = params[i].split('=');
data[tmp[0]] = tmp[1];
}
document.getElementById('here').innerHTML = data.name;
}
</script>
Description: JavaScript does not have any specific feature to share data between different pages. However, there are some alternative ways to achieve it, e.g., using URL Parameters (I have used this approach in my code), cookies, localStorage, etc.
At first in the testing.html, store the name parameter in URL (?name=…). Then in the script of next.html, parse the URL and get all the params from previous page.
PS. I’m a non-native English speaker, will you please correct my message, if necessary.