簡體   English   中英

當該網址不允許在iframe中時,我需要重定向到該網址?

[英]I need to redirect to a url, when the url not allowed to be inside a iframe?

因為當您不直接加載iframe重定向google時,如果無法在iframe中顯示此頁面(例如google),我可以重定向到該頁面。

<script type="text/javascript">       
function redirect(iframe)
{
window.location = iframe.src;
}
</script>
<iframe src="http://www.google.com" onerror="redirect(this)"></iframe>

出於安全原因(跨瀏覽器功能),您無法使用JQuery從其他域訪問iframe中的元素。 您無權訪問iframe中的任何屬性。iframe可能不是最好的依賴。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM