Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我使用iframe-resizer在 iframe 中插入内容(jsf-pages)。那么,如何检测服务器响应 404 not found 呢?
是否有一些回调或其他方法来检测这一点?
const iframeResizerOptions = { log: true, checkOrigin: true, initCallback: (iframe) => { if (iframe.contentDocument.getElementsByClassName("error-title").length > 0) { onError(); } else { onLoad(); } }, };
您可以使用 initCallback 并从输入参数中获取 iframe。