Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/438.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript $(';#iframe';).load()在生产环境中响应非常晚,尽管它在开发(本地)环境中运行良好_Javascript_Jquery_Iframe - Fatal编程技术网

Javascript $(';#iframe';).load()在生产环境中响应非常晚,尽管它在开发(本地)环境中运行良好

Javascript $(';#iframe';).load()在生产环境中响应非常晚,尽管它在开发(本地)环境中运行良好,javascript,jquery,iframe,Javascript,Jquery,Iframe,警报(“已加载”)在生产后期触发。我想不出是什么原因导致它在生产后期启动 以下是原始代码的摘录: <html> <head> <script> function showIframe () { var html = '<iframe id="myIframe" src="https://calendly.com/.../15min"></iframe>'; $("#testDiv

警报(“已加载”)在生产后期触发。我想不出是什么原因导致它在生产后期启动

以下是原始代码的摘录:

<html>
  <head>
    <script>
      function showIframe () {
        var html = '<iframe id="myIframe" src="https://calendly.com/.../15min"></iframe>';

        $("#testDiv").html(html);

          setTimeout(function () {
            $("#myIframe").load(function (e){
              alert('loaded');
          });

        }, 200);

      }
    </script>
  </head>
  <body>

    <button onclick = 'showIframe()'>iFrame</button>
    <div id = 'content' style = 'width: 100px; height: 100px; background-color: lemonchiffon;'></div>

  </body>
</html>

函数showIframe(){
var html='';
$(“#testDiv”).html(html);
setTimeout(函数(){
$(“#myIframe”).load(函数(e){
警报(“已加载”);
});
}, 200);
}
iFrame

如果在IE/Edge下运行页面,加载https站点通常需要很长时间。谷歌你会找到关于它的链接。其他浏览器应该可以。

我在此iframe中加载的URL是一个外部URL(即与我的网站无关)。