如何使用JavaScript停止网页加载,直到iframe加载完成?
您可以通过以下代码实现:
var iframe = document.getElementById('your-iframe-id');
iframe.onload = function() {
// 如果iframe加载完成,则停止网页加载
window.stop();
};
其中,'your-iframe-id' 是您的 iframe 元素的 ID。当 iframe 加载完成后,'onload' 事件就会触发,然后通过 'window.stop()' 停止网页的加载。
原文地址: https://www.cveoy.top/t/topic/nMnZ 著作权归作者所有。请勿转载和采集!