Pass variable between pages

Pass variable between pages

Hello everyone,


I've tried to solve this problem for quite a while without success, so it would be awesome if someone could help me. I want to create a webapp with a tag cloud as navigation tool. No problem there, but if someone clicks on a tag in the cloud he should get images related to the tag. So I need to pass the information which tag was clicked to show the right images.


Its works just fine to pass this information between pages using multiple .html documents. Then I can write the tag in the domain. But I would like to summarize everything in a single .html document (to be able to save it at the homescreen and use fullscreen). My code is a mess, so I will just show you what I've tried so far to pass the information in one .html document:


on the second page I write every tag like this:


document.write('<li><a data-parm="'+jMatches[i]+'" href="#TagImages.php" style="font-size:' + fontsize + 'px; font-weight:bold">');
document.write(jMatches[i]); document.write('</a></li>' + " ");

JMatches[i] is my tag and with data-parm I try to store the information.
On the third page I want to get the tag which was clicked like this:

$("a").on("click", function (event) {
      var Taginput = $(this).data("parm");
});

It works to store the information in the variable Taginput, but because the page was already loaded before the user clicked on the tag, nothing will change on the third page. Is there a possibility to just reload a single page in the .html document? I would be thankful for any help!