English 中文(简体)
哪一种javascriptloading办法会对页数时间产生最微小的影响?
原标题:Which javascript loading option would have the most negligible effect on page load time?

我要说的是,我在服务器上有一个javascript文档,网址是:,我希望有3个政党网站装上。

在第三方所在地,你可以补充:

<script src="www.website.com/javascripts/application.js" type="text/javascript"></script>

but it would need to evaluate all of the javascript before fully loading the page.

相反,如果第三方所在地点有类似的东西的话。

<script type="text/javascript>
  var script = document.createElement( script );
  script.setAttribute( type ,  text/javascript );
  script.setAttribute( src ,  www.website.com/javascripts/application.js );
  document.getElementsByTagName( head ).appendChild(script);
</script>

这是否会使页数时间发生变化? 它是否像往常一样装上 j子档案?

该网站是否

<script src="www.website.com/javascripts/dynamic_loader.js" type="text/javascript"></script>

与动态建造连接<代码>应用程序>.js文档的文字标签有关的文字,如上面的例子权利?

什么是最佳选择,为什么? 是否有更好的办法装载我不知道的第三方java描述?

问题回答

Your second option will load the script asynchronously and the page can display before the script has loaded. This can be an advantage if you re optimizing for page display time and no page initialization scripts need to use your script. This can be a disadvantage (and won t speed the overall page load up) if everything else just has to wait for your script to load before the page can be fully populated.

So, it really depends upon what the script does. A perfect example of something that can be successfully loaded asynchronously is Google Analytics because it s 100% stand-alone. Nothing else on the page depends upon it. When exactly it loads doesn t matter at all in relation to the page display.

可能真正从装货中获利的一个实例是,在显示初始内容或具有附属文字的文字方面发挥不可或缺的作用,这些文字在显示初步内容方面发挥着不可或缺的作用。 既然在装上任何载荷之前,你可以看看一看内容,那么,这确实无助于使事情成为一 load。

如果你只想根据需求(不一定是当页数实际需要时)装上模块,那么动态负荷(即最后选择)最为有用。





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签