gpt4 book ai didi

html - iframe 中的内容会重定向,但不会重定向整个页面

转载 作者:行者123 更新时间:2023-11-28 01:18:52 27 4
gpt4 key购买 nike

所以我有一个列,里面有这段代码:

<div class="cat">
<iframe src="sidebar.html" frameborder="0" ></iframe>
</div>

这是“sidebar.html”中的一行:

<th target="_top" onclick="window.location='http://example.com'">example</th>

(记住这是表格的一部分)

当我点击“example”这个词时,它实际上会重定向到它应该去的地方,但这只在 iframe 中可见

我想将整个页面重定向到 www.example.com

最佳答案

只需添加“parent”。在 window.location 之前:

<th target="_top" onclick="parent.window.location='http://example.com'">example</th>

关于html - iframe 中的内容会重定向,但不会重定向整个页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51637071/

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