English 中文(简体)
持有非锁定本
原标题:Obsession with non-blocking scripts

Since i discovered the concept of non-blocking scripts i have become obsessed with loading all my external scripts this way. I have even hacked Joomla! templates(which i know is a bad practice) in order to load non-blocking scripts in the index.php file. Example code below.

(function() {
    var script = document.createElement( script ),  head = document.getElementsByTagName( head )[0]; 

    script.type =  text/javascript ; 
    script.src = "http://www.mywebsite.com/scripts/one_of_many.js"
    head.appendChild(script);
})();

我的问题是:

装载非锁定的文字是好的/坏的?

使用非锁定的文字应当有什么样的限制?

最佳回答

您重新使用非锁定文字(应用文字材料DOM要素)的方法将不对所有浏览器,仅凭“UN”和“OM”发出文字执行令。

如果你不关心执行命令,你可以安全使用。

否则,你就能够将其与其他一些技术结合起来,例如将文字放在单体或XHR上。

http://www.scribd.com/doc/14789201/Even-Faster-Websites”rel=“nofollow”

问题回答

如果你把文件装上许多文件,即使不是锁定文件,你也可以通过在<条码>和>之前把文件放在你结尾处才能做到这一点;标签,因为浏览器在页面上找到了事情,如果你装上了相当一部分。

它这样做的好坏,但是,它更能看到档案的合并和清白/篡改,以获得更多的时间。 另一项显而易见的事情是,确保你利用提供给浏览者的联合材料。





相关问题
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.

热门标签