And*_*y E 38
使用该window.history对象.
// For the current window
window.history.back();
window.history.forward();
// For an iframe's window
iframe.contentWindow.history.back();
iframe.contentWindow.history.forward();
Run Code Online (Sandbox Code Playgroud)
要么
iframe.contentWindow.history.go(-1); // back
iframe.contentWindow.history.go(1); // forward
Run Code Online (Sandbox Code Playgroud)
https://developer.mozilla.org/en/dom/window.history
框内按钮:
<input type="button" value="Back" onclick="history.back()">
Run Code Online (Sandbox Code Playgroud)
父框架内的按钮:
<input type="button" value="Back" onclick="frame_name.history.back()">
Run Code Online (Sandbox Code Playgroud)
2017年更新:如果iframe内容的来源与封闭页面的来源不同,则无法做任何事情 - 除非您控制远程来源的内容并且可以让它接受postMessage事件.如果原点相同,则较旧的答案仍然有效.
| 归档时间: |
|
| 查看次数: |
57992 次 |
| 最近记录: |