gpt4 book ai didi

javascript - iframe 中的后退和前进按钮

转载 作者:行者123 更新时间:2023-12-02 00:14:59 25 4
gpt4 key购买 nike

如何用 JS 在 iframe 中“实现”后退和前进按钮?

最佳答案

使用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();

iframe.contentWindow.history.go(-1); // back
iframe.contentWindow.history.go(1); // forward

https://developer.mozilla.org/en/dom/window.history

关于javascript - iframe 中的后退和前进按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3254985/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com