有没有可能被解雇'onload'iframe'在HTML页面中

Is there any possibilities to get fired 'onload' event from 'iframe' in a html page

本文关键字:HTML iframe onload 有可能      更新时间:2023-09-26

如果有任何可能的方法来触发iframe的onload事件?,因为我的要求,我需要在iframe加载外部网站。尽管有些网站不允许在iframe

中加载他们的页面

例如:https://www.google.co.in,我需要验证url是否有效加载在iframe或不。谁能建议我解决这个问题?

试试下面的代码:

if (iframe.attachEvent){
     iframe.attachEvent("onload", function(){
         alert("Local iframe is now loaded."(www.111cn.net));
     });
 } else {
     iframe.onload = function(){
         alert("Local iframe is now loaded.");
     };
 }