将外部网站动态加载到Iframe中 - 有更好的方法吗? [英] Loading external sites into Iframe dynamically - is there a better way?

查看:223
本文介绍了将外部网站动态加载到Iframe中 - 有更好的方法吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经构建了一个当前使用Iframe加载外部网站的应用程序。

I've build an application which currently uses an Iframe to load external sites.

这种方法确实减慢了我的应用程序速度 - 加载最多需要5秒钟
可能在其自己的选项卡/窗口中加载<1秒的页面。

This method is really slowing my application down - taking up to 5 seconds to load a page that might load in <1sec in it's own tab/window.

我可以实现哪些解决方案可以让速度更快?! ?

Is there any solution I can implement which will let get more speed?!?

谢谢!

编辑:

这是我目前正在使用的代码:

Here's the code I'm currently using:

<script type="text/javascript">

// Change iFrame on a Button Click Event
$("#myButton").click(function(event){            
    $("#myIFrame").attr('src', $('#url').val());
});

</script>

<input class="url_top" type="text" id="url" value="http://">
<a id="myButton" href="#">Load</a> 
<iframe id="myIFrame" height="80%" width="100%" class="netframe" src="page.php"></iframe>


推荐答案

@Simon,如果您要将网站加载到iFrame中那么你可能正在做一个缩略图吗?这样做会很慢,因为每个页面都需要在你的页面中渲染,这样你就可以将外部网站的速度提高n倍,其中n是页面上的网站数量。

@Simon, if you are loading sites into an iFrame then you are probably doing a thumbnail right? Doing this is going to be slow as each page needs to render in yours so you are contending with the speed of the external site by a factor of n where n is the number of sites on your page.

请提供更多关于您想要的结果的信息,以便伟大的社区可以就不同的策略提供建议。

Please provide more info on what the outcome is that you want so that the greatter community can advise on perhaps different tactics.

这篇关于将外部网站动态加载到Iframe中 - 有更好的方法吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆