Back button with iFrames
I am using an iframe to display content that has links. When the user clicks on an iFrame and clicks back, they return to the iFrame. This is normal. However, once they return to the first page of the iFrame, and they "come back" again, the entire window will be returned to the previous page. This is undesirable.
To prevent this behavior, I added a fake back button to the iFrame. (This is a bad interface in most cases, in which case it works well). I would like this replace button to be returned only if the previous page is an iFrame page and not the entire page. When they hit the swap button in an iFrame, it should only move that iFrame back, nothing else. Is there a way to do this? IFrame gets its own story object?
Something that might be useful: the domain of the iFrame and the main window is great. That way, if the "global" history object can be read, I can check if the previous page was mine by checking if the domain belongs to me. If the domain is not mine, the fake button button will be hidden or will do nothing.
Help with gratitude, and happy holidays!
source to share
You should be able to use a javascript history object to return a user; but you won't be able to stop it when the iframe's click is over and the main page wants to return. And you cannot stop it because it is deliberately locked in most browsers to prevent people from messing with it maliciously.
- You can write your own history tracking code and also remove items that will be removed from this stack when the stack is empty ...
- If you are using complex nesting of links - perhaps some kind of javascript based tree view menu? So the iframe never refreshes the page?
Lacking an example, I must say that your design seems like a bad interface ... when I hit, I don't want the navigation to change; I want to go back to whatever page I've just been to.
source to share