如何在不阻止Google Chrome上的整个页面的情况下加载脚本?

时间:2022-10-12 18:33:07

如何在不阻止Google Chrome上的整个页面的情况下加载脚本? I am developing a website that uses an Ajax plugin to like/dislike/comments an item. But when there are multiple items on the same page, the page takes too long to be displayed. On google chrome for instance, for 10 items you have to wait something like 10 seconds before you can see anything.

我正在开发一个使用Ajax插件来喜欢/不喜欢/评论项目的网站。但是当同一页面上有多个项目时,页面显示的时间太长。例如,在谷歌浏览器上,对于10个项目,您必须等待10秒才能看到任何内容。

But in Firefox, and IE 8, the other elements of the page are displayed, and only the likes/dislikes take some time. But the advantage is that they are displayed as soon as they are loaded. So this is much better.

但是在Firefox和IE 8中,显示了页面的其他元素,只有喜欢/不喜欢需要一些时间。但优点是它们在加载后立即显示。所以这要好得多。

So why is Google Chrome less efficient than Firefox and IE? Is there a trick to display on Chrome the page like in Firefox?

那么为什么Google Chrome的效率低于Firefox和IE呢?是否有一个技巧可以在Chrome浏览器中显示这样的页面?

I have attached a Firebug image of the loading page.

我附上了加载页面的Firebug图像。

Thanks for your help.

谢谢你的帮助。

2 个解决方案

#1


2  

Try placing your scripts at the bottom of the page, just before the closing </body> tag

尝试将脚本放在页面底部,就在结束 标记之前

http://developer.yahoo.com/performance/rules.html#js_bottom

See a whole bunch of other tips here

在这里查看一大堆其他提示

http://developer.yahoo.com/performance/rules.html

#2


1  

Adding to what Jason mentioned, dynamically loading scripts is also a very good option. You can insert the <script> tag to the DOM and then load the .js files using JavaScript.

除了Jason所提到的,动态加载脚本也是一个非常好的选择。您可以将

#1


2  

Try placing your scripts at the bottom of the page, just before the closing </body> tag

尝试将脚本放在页面底部,就在结束 标记之前

http://developer.yahoo.com/performance/rules.html#js_bottom

See a whole bunch of other tips here

在这里查看一大堆其他提示

http://developer.yahoo.com/performance/rules.html

#2


1  

Adding to what Jason mentioned, dynamically loading scripts is also a very good option. You can insert the <script> tag to the DOM and then load the .js files using JavaScript.

除了Jason所提到的,动态加载脚本也是一个非常好的选择。您可以将