First of all, not that good with Javascript. So if you have an answer, please use a fully working script.
I am trying to build a personal web page, which acts as a browser. (part of a larger system) So I need a back and forward button. Found alot of (older) articles, which all don't work for me, and the ones who did work, didn't work well.
Tryed many things, but I want to use a function to control things. I found out that I should use the history.back() thingy, and it did work once for the main page, from within a direct button. (can't seem to get it to work from inside a function)
So here is my code so far:
<!DOCTYPE html>
<html>
<body>
<iframe align="center" width="100%" height="20%" src="http://www.google.nl" frameborder=yes scrolling="yes" name="iframe" id="iframe"> </iframe>
<button type="button" onclick="ownBack()">Click me</button>
<script type="text/javascript">
function ownBack() {
var x = document.getElementById('iframe');
var y = (x.contentWindow || x.contentDocument);
y.history.back();
}
</script>
</body>
</html>
*PS: Using latest firefox, and got the "ignore X-frame options" plugin, so google and all other pages should work in iframes. You might want to change the url for the iframe while testing.