Title: Async JS and CSS
Author: dmikam
Published: <strong>2013 年 8 月 25 日</strong>
Last modified: 2013 年 11 月 18 日

---

搜尋外掛

這個外掛**並未在最新的 3 個 WordPress 主要版本上進行測試**。開發者可能不再對這個
外掛進行維護或提供技術支援，並可能會與更新版本的 WordPress 產生使用上的相容性問題。

![](https://s.w.org/plugins/geopattern-icon/async-js-and-css.svg)

# Async JS and CSS

 由 [dmikam](https://profiles.wordpress.org/dmikam/) 開發

[下載](https://downloads.wordpress.org/plugin/async-js-and-css.zip)

 * [詳細資料](https://tw.wordpress.org/plugins/async-js-and-css/#description)
 * [使用者評論](https://tw.wordpress.org/plugins/async-js-and-css/#reviews)
 *  [安裝方式](https://tw.wordpress.org/plugins/async-js-and-css/#installation)
 * [開發資訊](https://tw.wordpress.org/plugins/async-js-and-css/#developers)

 [技術支援](https://wordpress.org/support/plugin/async-js-and-css/)

## 外掛說明

When your page is loaded by browser – all that stuff placed in HEAD tag is loaded
before the page content – in blocking way. So the content is delivered to user in
the last moment, after all javascript and css files are loaded.

If you are a webmaster or just want to make your web to make better your positions
on search engines (yes, they preffer faster webs), just take a look on Google PageSpeed
Insights – you’ll see that one of the mos important things is fastenes and one of
the reason why your page is not so fast – is “Render-blocking JavaScript and CSS”.

This plugin makes ALL scripts loaded by other plugins to be loaded in asynchronous
way just like Google PageSpeed Insights recommends.
 All CSS files will be inserted
inline into the document code or moved from the document beginning to the end, just
before closing BODY tag (or just where you placed wp_foot() function). There are
various methods to do that – they are all in plugin’s configuration page.

Plugin makes all scripts to be loaded asynchronously using wp_enqueue_script and
also can detect scrips included inside of wp_head and wp_footer hooks.

All CSS files loaded using wp_enqueue_style can be loaded just before closing BODY
tag by four methods:

    ```
    * inserting <link rel="stylesheet" ...> tag

    * inserting <style>@import url(...);</style>

    * generating <link rel="stylesheet" ...> tag with javascript after all have loaded

    * inserting ALL CSS CODE INLINE into the document (the fastest way)
    ```

I was inspired to create this small plugin by Asynchronous Javascript but it works
in completely different way.

### Known incompatibilities

    ```
    * Internet Explorer 7 - Some scripts could be loaded impropertly (trying to fix it)

    * Plugin - WP JetPack - Share - everithing works but "More" dropdown menú

    * Plugin - Google Analyticator<h3>Special thanks</h3>
    * NicMic<h3>TODO</h3>
    * Inline JS
    * Minify JS
    * Cache
    ```

## 螢幕擷圖

[⌊Settings page⌉⌊Settings page⌉[

Settings page

[⌊PageSpeed Insights results⌉⌊PageSpeed Insights results⌉[

PageSpeed Insights results

## 安裝方式

Like any other plugin

    ```
    1. Upload `asyncJSandCSS` folder to the `/wp-content/plugins/` directory

    2. Activate the plugin through the 'Plugins' menu in WordPress

    3. Configure the plugin if needed (Settings/Async Settings)
    ```

Plugin can affect only those files loaded using worpdress’s queue (using wp_enqueue_script
and wp_enqueue_style), so if you include your CSS file inserting into head.php of
your theme – it WILL NOT be affected and will be loaded in standart render-blocking
way.

## 常見問題集

  Installation Instructions

Like any other plugin

    ```
    1. Upload `asyncJSandCSS` folder to the `/wp-content/plugins/` directory

    2. Activate the plugin through the 'Plugins' menu in WordPress

    3. Configure the plugin if needed (Settings/Async Settings)
    ```

Plugin can affect only those files loaded using worpdress’s queue (using wp_enqueue_script
and wp_enqueue_style), so if you include your CSS file inserting into head.php of
your theme – it WILL NOT be affected and will be loaded in standart render-blocking
way.

  What can I do with a “Leverage browser caching” warning in Google’s PageSpeed 
Insights ?

You just need to include cache configuration in your .htaccess file. For example:

    ```
    <IfModule mod_expires.c>
        ExpiresActive On
        ExpiresByType image/gif "access plus 6 month"
        ExpiresByType image/jpeg "access plus 6 month"
        ExpiresByType image/png "access plus 6 month"
        ExpiresByType application/javascript "modification plus 1 month"
        ExpiresByType text/css "modification plus 1 month"
    </IfModule>
    ```

  Errors with jQuery

Add this line to exceptions box:

    ```
    jquery
    ```

or if you are using jQuery from Google Hosted Libraries, you need to put:

    ```
    jquery.min.js
    ```

  Colorbox is not working

Add this line to exceptions box:

    ```
    colorbox
    colorbox-wrapper
    ```

## 使用者評論

![](https://secure.gravatar.com/avatar/36d6704be939e898756a33ecd38cce84133516dbbab1b3e14de11362d527781b?
s=60&d=retro&r=g)

### 󠀁[good plugin](https://wordpress.org/support/topic/good-plugin-3000/)󠁿

 [lanuevareligiondt](https://profiles.wordpress.org/lanuevareligiondt/) 2018 年 
8 月 3 日

nice job

![](https://secure.gravatar.com/avatar/82ef3b3f4a18a2f1b476d8986eb82874d44604d3c4832b0ac655953d84ff03ea?
s=60&d=retro&r=g)

### 󠀁[Crashed page](https://wordpress.org/support/topic/crashed-page/)󠁿

 [wpprup](https://profiles.wordpress.org/wppraesenz/) 2017 年 5 月 19 日

This plugin crashed many functions in my Divi page. The worst thing of it all is
that the page did not get restored by neither deactivating the functions nor the
whole plugin! Plus, the last support answer is one year old so there was obviously
no hope for help. It was the first time ever I had to replay a backup of my site
which is absolutely recommended to make before you install this troublesome plugin
IMHO. I would warn from using this plugin after my experiences.

![](https://secure.gravatar.com/avatar/e6893c1e136a85aceee1e85c7bce822bd8e899d988c0ef7679e77fe929d2c930?
s=60&d=retro&r=g)

### 󠀁[Very good plugin](https://wordpress.org/support/topic/very-good-plugin-233/)󠁿

 [Abhishek Ghosh](https://profiles.wordpress.org/abhishek_ghosh/) 2016 年 10 月 
14 日

Does the job and helps to do more tweaks.

![](https://secure.gravatar.com/avatar/1e19ac6519e9e980496c8016529eb47d4ad74c3477475fb40ee701c834aafb0e?
s=60&d=retro&r=g)

### 󠀁[Disables the slider](https://wordpress.org/support/topic/disables-the-slider/)󠁿

 [Holyto](https://profiles.wordpress.org/holyto/) 2016 年 9 月 3 日

Giving it 1 star because it breaks the site, especially the Revslider. Don't risk.

![](https://secure.gravatar.com/avatar/44b88efb4f93a02a4eca60a22a4431d7ed8918c1d2a44b34d65c66599f90e161?
s=60&d=retro&r=g)

### 󠀁[Page loads longer as without plugin](https://wordpress.org/support/topic/page-loads-longer-as-without-plugin/)󠁿

 [w3arts](https://profiles.wordpress.org/w3arts/) 2016 年 9 月 3 日

you will get a high pagespeed score but some parts of the site brakes and also my
site has lower request but loads longer as without plugin. For a small simple site
you may use it but for a complex one no chance to use it.

![](https://secure.gravatar.com/avatar/f5c0c59726571bfe0f9e1e42819011007776879c95ad8ee229e475b1b2e6d23a?
s=60&d=retro&r=g)

### 󠀁[Bug Async JS and CSS](https://wordpress.org/support/topic/bug-async-js-and-css/)󠁿

 [vidabandida](https://profiles.wordpress.org/vidabandida/) 2016 年 9 月 3 日

Async JS and CSS prevents plug-in theme JavaScript and CSS are loaded properly and
do WPtouch plugin to work how can I solve this?

 [ 閱讀全部 51 則使用者評論 ](https://wordpress.org/support/plugin/async-js-and-css/reviews/)

## 參與者及開發者

以下人員參與了開源軟體〈Async JS and CSS〉的開發相關工作。

參與者

 *   [ dmikam ](https://profiles.wordpress.org/dmikam/)

[將〈Async JS and CSS〉外掛本地化為台灣繁體中文版](https://translate.wordpress.org/projects/wp-plugins/async-js-and-css)

### 對開發相關資訊感興趣？

任何人均可[瀏覽程式碼](https://plugins.trac.wordpress.org/browser/async-js-and-css/)、
查看 [SVN 存放庫](https://plugins.svn.wordpress.org/async-js-and-css/)，或透過 [RSS](https://plugins.trac.wordpress.org/log/async-js-and-css/?limit=100&mode=stop_on_copy&format=rss)
訂閱[開發記錄](https://plugins.trac.wordpress.org/log/async-js-and-css/)。

## 變更記錄

=1.7.13=

Removed foreach PHP warnings

=1.7.12=

Minify CSS method is more reliable with multiline commments.

Minify CSS compression bettered.

Added localization support

Added Spanish language

Added Russian language

Default CSS loading method is changed to “Inline in HEAD”

=1.7.11=

Better dependencies list build.

=1.7.10=

Changed hooks min priority to make them always non-negative.

Removed unsetting of dependencies of excluded scripts.

=1.7.9=

Fixed some path issues in CSS url(…)

Fixed some warnings

=1.7.7=

Support for dependensy only enqueued scripts with no src specyfied.

Fixed WordPress dependency jquery-core for jquery-migrate.

Added support to CSS inlined resourses like url(data:application/font….)

=1.7.6=

Added support for CSS media conditions and queries.

Converting JS files relative URLs to absolute form.

=1.7.5=

Fix: CSS minify function

Fix: Incorrectly detected wordpress installation URL for CSS inlineing

=1.7.2=

Option to include inline CSS in HEAD tag

=1.7.1=

Fixed .css files exclusion option

=1.7=

Option to remove an ?ver=XXX part from scripts and css files URLs

Option to exclude some files and to load them in default render-blocking way.

=1.6=

Added Settings page

Possibility to load CSS in inline mode and to minify it

Some other improvements

=1.5=

Better regular expression used to get scripts loaded in wp_foot.

CSS files are loaded using javascript onload event to get better scores on Google
PageSpeed Insights and make loading of css REALLY asynchronous.

=1.4=

Added detection of scripts added through wp_head hook

=1.2=

Incompatibility with jQuery lightbox solved.

=1.1=

Some workaround about compatibility with jQuery Colorbox and JetPack

=1.0=

First release

## 中繼資料

 *  版本 **1.7.13**
 *  最後更新 **9 年前**
 *  啟用安裝數 **700+**
 *  WordPress 版本需求 ** 2.6 或更新版本 **
 *  已測試相容的 WordPress 版本 **3.7.41**
 *  語言
 * [English (US)](https://wordpress.org/plugins/async-js-and-css/)
 * 標籤:
 * [async](https://tw.wordpress.org/plugins/tags/async/)[asynchronous](https://tw.wordpress.org/plugins/tags/asynchronous/)
   [headjs](https://tw.wordpress.org/plugins/tags/headjs/)[javascript](https://tw.wordpress.org/plugins/tags/javascript/)
   [JS](https://tw.wordpress.org/plugins/tags/js/)
 *  [進階檢視](https://tw.wordpress.org/plugins/async-js-and-css/advanced/)

## 評分

 4.2 星，滿分為 5 星

 *  [  36 個 5 星使用者評論     ](https://wordpress.org/support/plugin/async-js-and-css/reviews/?filter=5)
 *  [  3 個 4 星使用者評論     ](https://wordpress.org/support/plugin/async-js-and-css/reviews/?filter=4)
 *  [  3 個 3 星使用者評論     ](https://wordpress.org/support/plugin/async-js-and-css/reviews/?filter=3)
 *  [  2 個 2 星使用者評論     ](https://wordpress.org/support/plugin/async-js-and-css/reviews/?filter=2)
 *  [  7 個 1 星使用者評論     ](https://wordpress.org/support/plugin/async-js-and-css/reviews/?filter=1)

[撰寫評分](https://wordpress.org/support/plugin/async-js-and-css/reviews/#new-post)

[查看全部使用者評論](https://wordpress.org/support/plugin/async-js-and-css/reviews/)

## 參與者

 *   [ dmikam ](https://profiles.wordpress.org/dmikam/)

## 技術支援

使用者可在技術支援論壇提出意見反應或使用問題。

 [檢視技術支援論壇](https://wordpress.org/support/plugin/async-js-and-css/)

## 贊助

想要支援這個外掛的發展嗎？

 [ 贊助這個外掛 ](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=DNZ7D68MBS6KN)