1

我有一个包含多个页面的 html。我有一些页面可以在 iframe 中打开。当我打开 html 页面(其中包含所有页面)时,它开始加载所有 iframe,页面变得如此缓慢和缓慢。有什么办法可以禁用自动 iframe 加载?或者有没有其他方法可以打开没有 iframe 的页面但仍留在我的应用程序中?这是我页面的一部分(在一个 html 中)代码:

<html>
    <head>
    </head>
    <body>
        <div data-role="page" id="website">
            <div data-theme="a" data-role="header">
                <a href="#home" data-theme="a" data-role="button" data-icon="arrow-l" title="back-button">Back</a>                  
                    Idan    
            </div>    
            <div>    
                <iframe src="http://www.idan.com" style="border: 0; position:absolute; top:43px; left:0; right:0; bottom:0; width:320px; height:480px; background: white"></iframe>            
            </div>    
        </div>    
        <div data-role="page" id="website1">
            <div data-theme="a" data-role="header">
                <a href="#home" data-theme="a" data-role="button" data-icon="arrow-l" title="back-button">Back</a>                  
                    Idan    
            </div>    
            <div>    
                <iframe src="http://www.idan1.com" style="border: 0; position:absolute; top:43px; left:0; right:0; bottom:0; width:320px; height:480px; background: white"></iframe>            
            </div>    
        </div>    
        <div data-role="page" id="website2">
            <div data-theme="a" data-role="header">
                <a href="#home" data-theme="a" data-role="button" data-icon="arrow-l" title="back-button">Back</a>                  
                    Idan    
            </div>    
            <div>    
                <iframe src="http://www.idan2.com" style="border: 0; position:absolute; top:43px; left:0; right:0; bottom:0; width:320px; height:480px; background: white"></iframe>            
            </div>    
        </div>
    </body>
    </html>
4

2 回答 2

1

如果您使用 javascript 设置 iframe 的 src 属性,您可以控制它们应该加载的时间。

于 2013-05-23T14:01:14.007 回答
0

汤姆是对的,

把它放在你的 html 的底部,但在标签之前

<script>
document.getElementById("myIframe").src = "http://www.idan1.com";
</script>

您必须将 id 标签添加到 iframe 并删除 src

              <iframe id="myIframe" style="border: 0; position:absolute; top:43px; left:0; right:0; bottom:0; width:320px; height:480px; background: white"></iframe>            

你甚至可以看中,并做一组onload。

于 2013-05-23T14:16:41.500 回答