I’ve just noticed that my JavaScript history control targeted at a iFrame is affecting the parent. The code is:
document.getElementById('iframeid').contentWindow.history.back(-1);
document.getElementById('iframeid').contentWindow.history.forward(-1);
It works fine, until there is nothing to go back or forward in the iframe, where then it will affect the parent frame moving that backwards and forwards, this is occurring on all major browsers, safari, opera, chrome, firefox, ie 6 7 8.
Anyone know how to stop it?
Check the
historyobject’slengthfirst:The condition will run only when there is something for the
historyobject to navigate around.