一直在嵌套在另一个 iframe 中的 iframe 中尝试以下操作:
<a href="https://example.com" target="_parent">Link</a>
<a href="https://example.com" target="_top">Link</a>
<a href="https://example.com" target="_self">Link</a>
但是,它们都在新窗口中打开,而不是在 iframe 所在的窗口中打开。如何确保链接在顶部浏览器窗口中打开?
最佳答案
如果您希望子页面中的每个链接都可以在托管 iframe 的网页中打开,那么您可以在子页面中添加此标记:
<base target="_top" />
关于javascript - 如何在嵌套 iframe 所在的原始窗口中打开链接?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33221661/