首頁  >  文章  >  web前端  >  以下是一些適合所提供內容的問題標題: 選項 1(技術性更強): * 如何使用 JavaScript 從 Iframe 重新導向父視窗? 選項 2(更多對話):

以下是一些適合所提供內容的問題標題: 選項 1(技術性更強): * 如何使用 JavaScript 從 Iframe 重新導向父視窗? 選項 2(更多對話):

Susan Sarandon
Susan Sarandon原創
2024-10-26 13:13:29642瀏覽

Here are a couple of question titles that fit the provided content:

Option 1 (More technical):

* How to Redirect the Parent Window from an Iframe using JavaScript?

Option 2 (More conversational):

* Want to Redirect the Parent Window from an Iframe? He

從iframe 重新導向父視窗

問題:

如何使用從🎜重定向父視窗?目標是當單擊 iframe 中的超連結時將父視窗重定向到新 URL。

答案:

要重定向頂級父 iframe:

<code class="javascript">window.top.location.href = "http://www.example.com";</code>

重定向直接父級 iframe:

<code class="javascript">window.parent.location.href = "http://www.example.com";</code>

以上是以下是一些適合所提供內容的問題標題: 選項 1(技術性更強): * 如何使用 JavaScript 從 Iframe 重新導向父視窗? 選項 2(更多對話):的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn