19

GitHub source code address: https://github.com/justjavac/ReplaceGoogleCDN .

Replace Google CDN with domestic ones.

origin

For well-known reasons, you only need to replace a domain name to continue using the front-end public library provided by Google.
Similarly, script tag, so that the website access speed can be speeded up instantly!

Many websites, especially foreign websites, use Google's CDN in order to speed up the website.
However, in China, due to some reasons, the fastest CDN in the world has become the slowest in the world.

So, I wrote this plug-in/extension to replace Google's CDN with a domestic one.

principle

This plugin/extension can replace the following CDN resources with domestic ones:

  1. ajax.googleapis.com -front-end public library
  2. fonts.googleapis.com -free font library
  3. themes.googleusercontent.com -fonts sometimes use the resources in this
  4. fonts.gstatic.com -free font library
  5. www.google.com/recaptcha -Google Image Verification Library
  6. secure.gravatar.com -gravatar avatar

effect

After installing the extension/plugin, visit the https://stackoverflow.com/questions page:

The first line is the original request https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js , which was intercepted and replaced. The returned status code was 307 Internal Redirect, which took 26ms. The third line is the request after jquery.min.js is replaced, 33kB, and it takes 95ms.

The following table is a comparison of network requests for various resources (100% based on the speed after replacement):

ResourcessourceSize(kB)Time (ms)Speed (B/ms)percentage
jquery.min.jsajax.googleapis.com026--
stub.en.jscdn.sstatic.net18.029361.418%
jquery.min.jsajax.loli.net ⚡️33.195348.4100%
clc.min.jscdn.sstatic.net4.239910.530%
full.en.jscdn.sstatic.net99.6534186.554%
gpt.jssecurepubads.g.doubleclick.net21.385250.672%
analytics.jsgoogle-analytics.com19.679248.171%
quant.jssecure.quantserve.com9.142021.762%
beacon.jssb.scorecardresearch.com1.87324.771%
integrator.jsadservice.google.com 🐌0.3873.41%
markup.jsclc.stackoverflow.com 🐌9.225236.510%
osd.jsgoogletagservices.com28.190312.289%
rules-p-c1rF4kxgLUzNc.jsrules.quantcount.com 🐌0.4964.21%
keyboard-shortcuts.en.jscdn.sstatic.net7.37597.327.9%

installation

Online installation

Manual installation

Chrome installation method (Google is blocked by the wall):

  1. Download ReplaceGoogleCDN and unzip it to find the extension subdirectory
  2. Open Chrome and enter: chrome://extensions/
  3. Check Developer Mode
  4. Select Load unpacked extension... and then navigate to the chrome directory in the unpacked folder, confirm
  5. This is installed, remove the Developer Mode check.

GitHub source code address: https://github.com/justjavac/ReplaceGoogleCDN .


justjavac
47.8k 声望15.9k 粉丝

会写点 js 代码