It all began with a function called loadround that changed the innerHTML of an iframe. The links within the iframe would then change the page when clicked, but hitting the back button made the loadround page vanish. I pondered over this issue multiple times without success, so I experimented with some code.
<a href="javascript:void(loadround('parameter1','parameter2'))">loadround</a>
Then, I tested out the following code:
function loadround(a,b){
window.location.hash = "#loadround('"+a+"','"+b+"')";
var code = "<(h2)>"+a+"</(h2)><(h2)>"+b+"</(h2)>"
var iFrame = document.getElementById('iframe');
var iFrameBody;
iFrameBody = iFrame.contentDocument.getElementsByTagName('body')[0]
iFrameBody.innerHTML = code;
}
(note: the brackets in the h2 tags are purposeful) Next, I attempted to reload the function using an onload function, but for testing purposes, I used a simple href like this:
function check(){
var func = location.hash.replace(/#/, '')
void(func);
}
<a href="javascript:check()">check</a>
Unfortunately, the check code did not work as expected, and I believe there must be a simpler way to achieve this. I also tried changing the src of the iframe instead of altering the innerhtml, but encountered the same issue. Appreciate any help in advance!