4

I have a google font / stylesheet being loaded over http, how do I change it to https?

Its causing error messages to crop up on my secure pages like this:

Mixed Content: The page at 'https://www.mydomain.co.uk/customer/account/' was loaded over HTTPS, but requested an insecure stylesheet 'http://fonts.googleapis.com/css?family=Open+Sans:600italic,300,700,400,600'. This request has been blocked; the content must be served over HTTPS.

Fabian Schmengler
66.2k25 gold badges191 silver badges422 bronze badges
asked Jul 12, 2015 at 23:33

1 Answer 1

5

You can do it this way:

@font-face {
 font-family: 'Open Sans';
 font-style: normal;
 font-weight: 400;
 src: local('Open Sans'), local('OpenSans'), url(//fonts.gstatic.com/s/opensans/v10/cJZKeOuBrn4kERxqtaUH3VtXRa8TVwTICgirnJhmVJw.woff2) format('woff2');
}

See src section.

Instead of having font url with http put them this way: //fonts.gstatic.com/s/opensans/v10/cJZKeOuBrn4kERxqtaUH3VtXRa8TVwTICgirnJhmVJw.woff2. Here we have omitted http:.

This will make sure it runs with http and https both.

Hope this helps.

answered Jul 12, 2015 at 23:52

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.