內容簡介
雅虎卓越表現團隊建議將腳本置於頁面底部,因為瀏覽器下載元件的方式。
“腳本引起的問題在於它們阻塞並行下載。HTTP/1.1 規範建議瀏覽器每個主機名稱最多下載兩個元件。如果您從多個主機名稱提供圖片,您可以讓超過兩個下載並行發生。但是瀏覽器下載腳本時,即使在不同的主機名稱上,也不會開始任何其他下載。
在某些情況下,將腳本移到底部並不容易。例如,如果腳本使用 document.write 插入頁面的某個部分,則無法將其向下移動。可能還存在範圍問題。在許多情況下,有解決這些情況的方法。”
WordPress 的預設行為是在頁面中加載 JavaScript。
如果這些外掛正確聲明了 JavaScript,則此插件將移動所有 JavaScript 代碼到頁腳。
由Vladimir Prelovac製作的外掛。尋找WordPress 服務嗎?
許可證
此文件是Footer JavaScript的一部分。
Footer JavaScript 是自由軟體,您可以遵循GNU通用公共許可證的條款進行重新分發和/或修改,無論是許可證的第3版還是(根據您的選擇)任何之後版本。
Footer JavaScript 希望它是有用的,但沒有任何保證;甚至沒有適銷性或特定用途的隱含保證。有關更多詳細信息,請參見GNU通用公共許可證。
您應該已經收到了隨Footer JavaScript一起附帶的GNU通用公共許可證的副本。如果沒有,請參閱http://www.gnu.org/licenses/。
外掛標籤
開發者團隊
原文外掛簡介
The Yahoo! Exceptional Performance team recommends placing scripts at the bottom of your page because of the way browsers download components.
“The problem caused by scripts is that they block parallel downloads. The HTTP/1.1 specification suggests that browsers download no more than two components in parallel per hostname. If you serve your images from multiple hostnames, you can get more than two downloads to occur in parallel. While a script is downloading, however, the browser won’t start any other downloads, even on different hostnames.
In some situations it’s not easy to move scripts to the bottom. If, for example, the script uses document.write to insert part of the page’s content, it can’t be moved lower in the page. There might also be scoping issues. In many cases, there are ways to workaround these situations.”
WordPress default behavior is to load javascript in the page.
This plugin will move all javascript code to the footer if the plugins have declared javascript properly.
Plugin by Vladimir Prelovac. Looking for WordPress Services?
License
This file is part of Footer JavaScript.
Footer JavaScript is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Footer JavaScript is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Footer JavaScript. If not, see http://www.gnu.org/licenses/.
