简体   繁体   English

iframe-reizer中的错误处理?

[英]Error handling in iframe-resizer?

I use iframe-resizer to insert content(jsf-pages) in iframe. 我使用iframe-resizer在iframe中插入内容(jsf页)。 So, how to detect that server responsed with 404 not found? 那么,如何检测未响应404的服务器?

Is there some callback or other way to detect this? 是否有某种回调或其他方式可以检测到这一点?

 const iframeResizerOptions = {
    log: true,
    checkOrigin: true,
    initCallback: (iframe) => {
      if (iframe.contentDocument.getElementsByClassName("error-title").length > 0) {
        onError();
      } else {
        onLoad();
      }
    },
  };

You may use initCallback and get iframe from input parameter. 您可以使用initCallback并从输入参数获取iframe。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM