there is the page with two iframes:
<iframe src="fr1.html" name="fr1"></iframe>
<iframe src="fr2.html" name="fr2"></iframe
iframes contain code:
<a href="next_fr1.html">next<a/>
<div>frame 1</div>
and
<a href="next_fr2.html">next<a/>
<div>frame 2</div>
respectively.
开发者_StackOverflow社区Pages next_fr1.html
and next_fr2.html
contain this code:
<a href="javascript:parent.frames.fr1.history.back();">back<a/>
<div>next frame 1</div>
and
<a href="javascript:parent.frames.fr2.history.back();">back<a/>
<div>next frame 2</div>
respectively.
On the first page i clicked:
- "next" in the first iframe
- "next" in the second iframe
- "back" in the first iframe
After 3rd click is back in the second iframe (as if back button in browser) and not back in the first iframe?
The frames doesn't have separate histories, the page holds the history for all frames also.
When you call history.back
it goes to the previous step in the history of the page, so it will go back in the frame where the last navigation occured.
精彩评论