內容簡介
這個外掛將註冊、佇列的 CSS 或 JavaScript URL 轉換成它們的「協定相對」等效URL。
考慮以下示例:
協議相對 CSS URL
<link href="//example.com/wp-content/themes/twentytwelve/style.css" />
協議相對 JavaScript URL
<script src="//example.com/wp-includes/js/jquery/jquery.js"></script>
更合適地稱為「網路路徑參考」或「協議相對路徑」,協議相對 URL 有助於避免常見的情況,例如:
瀏覽器地址欄中顯示混合的HTTP/HTTPS內容時,SSL鎖定圖示出現問題
Internet Explorer 出現錯誤訊息,顯示「此頁面包含安全及非安全項目」
檢視HTTPS頁面時提供HTTP資源
協定相對 URL 的使用觀念是由 Paul Irish 推廣,隨著站點在 HTTP 和 HTTPS 資源之間切換,已成為常見的解決方案。
此外掛會將所有正確佇列的主題檔案標準化為使用協定相對路徑,即使這些檔案由第三方外掛程式新增。
注意:此外掛目前僅適用於註冊、佇列的 CSS/JavaScript 檔案,並不會轉換嵌入WordPress編輯器中或在主題其他位置上作為特色圖片輸出的任何圖像路徑。
外掛標籤
開發者團隊
② 後台搜尋「Protocol Relative Theme Assets」→ 直接安裝(推薦)
原文外掛簡介
This plugin transforms any registered, enqueued CSS or JavaScript URLs into their “protocol-relative” equivalent.
Consider the following examples:
Protocol Relative CSS URL
Protocol Relative Javascript URL
More appropriately called a “network-path reference” or “scheme-relative path”, a protocol-relative URL helps to avoid common scenarios such as:
Broken SSL padlock icon in browser’s address bar when showing mixed HTTP/HTTPS content
Error message in Internet Explorer saying, “This Page Contains Both Secure and Non-Secure Items”
Serving HTTP assets when viewing HTTPS pages
The idea of using protocol-relative URLs was popularized by Paul Irish and has become common as sites switch between serving HTTP and HTTPS assets.
This plugin will standardize all properly enqueued theme files to use protocol-relative paths, even those added from third-party plugins.
Note: This plugin does not transform any image paths that may be embedded in the WordPress editor or output as featured images or elsewhere in the theme — it presently only works on enqueued CSS/JavaScript files.
