Resolve Fonts.gstatic.com Cannot access

Source: Internet
Author: User

Many of Google's services have recently been limited in the mainland, for reasons not to be discussed too much. Shielding these services not only means Gmail, Google's academic and other convenient use of tools are limited, but also means that many of the Web services pinned to Google are not available. WordPress A lot of themes are used in Google font files, CSS files, JS files, etc., the screen after the access speed will be extremely slow or even can not open.

I also use Google fonts as a theme for many WordPress themes. Generally not when the login status can not see anything unusual, and if in the login state, do not load the page through the cache (that is, using CTRL+F5), you will find that the fonts.gstatic.com server is not connected at all. In other words, this problem has no effect on the average visitor and is not easily discovered. But now that we've found out, we're going to get rid of it.

Workaround: First, download the file to a local

1. Download the corresponding CSS. This step can be done through Chrome, Firefox, and other features provided by the review element. Switch to the network page to find the link that you can't access. For example, I have a http://fonts.gstatic.com/css?family=Open+Sans%3A300italic%2C400italic%2C600italic%2C300%2C400%2C600 here. &subset=latin%2clatin-ext&ver=3.9, the CSS content is copied locally by sending a request or by attempting to open the browser several times.

2. In the downloaded CSS file, bulk find out all the referenced font file links, such as:

@Font-face{Font-family: ' Open Sans ';Font-style:NormalFont-weight: 300;Src: Local' Open Sans light '),Local' Opensans-light '),URL (http://fontstatic.useso.com/s/opensans/v10/DXI1ORHCpsQm3Vp6mXoaTRa1RVmPjeKy21_GQJaLlJI.woff)Format' Woff ');}@Font-face{Font-family: ' Open Sans ';Font-style:NormalFont-weight: 400;Src: Local' Open Sans '),Local' Opensans '),URL (http://fontstatic.useso.com/s/opensans/v10/u-WUoqrET9fUeobQW7jkRT8E0i7KZn-EPnyo3HZu7kw.woff)Format' Woff ');}@Font-face{Font-family: ' Open Sans ';Font-style:NormalFont-weight: 600;Src: Local' Open Sans semibold '),Local' Opensans-semibold '),URL (http://fontstatic.useso.com/s/opensans/v10/MTP_ySUJH_bn48VBG8sNSha1RVmPjeKy21_GQJaLlJI.woff)Format' Woff ');}@Font-face{Font-family: ' Open Sans ';Font-style:ItalicFont-weight: 300;Src: Local' Open Sans light Italic '),Local' Opensanslight-italic '),URL (http://fontstatic.useso.com/s/opensans/v10/PRmiXeptR36kaC0GEAetxrsuoFAk0leveMLeqYtnfAY.woff)Format' Woff ');}@Font-face{Font-family: ' Open Sans ';Font-style:ItalicFont-weight: 400;Src: Local' Open Sans Italic '),Local' Opensans-italic '),URL (http://fontstatic.useso.com/s/opensans/v10/xjAJXh38I15wypJXxuGMBtIh4imgI8P11RFo6YPCPC0.woff)Format' Woff ');}@font-face { font-family:  ' Open Sans '; font-style: italic; font-weight: 600; src: local (  ' Open Sans semibold Italic '), local (url (http://fontstatic.useso.com/s/opensans/v10/ Prmixeptr36kac0geaetxmweb5poa5ztb49ylyuzh1a.woff) format ( ' Woff '); span class= "rule" >              

Can be directly matched via regular: Https://fonts.gstatic.*?. Woff Find all the links, and then bulk download (can use thunder or other download tools), stored in the local server.

3. Change the path of the Woff font file in the CSS above to the path you just saved.

4. Find Wp-includes inside the script-loader.php has a line:

"//fonts.googleapis.com/css?family=open+sans:300italic,400italic,600italic,300,400,600&subset=$subsets ";

The link inside is changed to the local storage of the CSS link, you can access the normal.

The benefit of this approach is that it is no longer dependent on external links, but the downside is that if you update the topic, or update WordPress, it may invalidate access.

Second, with the Use of common front-end Public Library

First on the link: http://libs.useso.com/inside the cache of Google's front-end public libraries and free font library, I have to say, although it is 360 do things, but really give force, included in the full, fast and stable access, point a praise it.

This is very convenient, only need to implement the 4th step of Method 1, the fonts.googleapis.com replaced fonts.useco.com will be done.

Of course, if the page is never accessible in the first step, you can access it here and then copy it locally.

Resolve fonts.gstatic.com cannot be accessed

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.