Answer the question
In order to leave comments, you need to log in
Why fonts are not connected + https://developers.google.com/speed/pagespeed/insights?
Не подключаются шрифт Roboto. Вопрос осложняется тем, что google pagespeed insights ругается на некоторые способы подключения.
Пробовал подключать так:
1. Как советует google fonts через link - page speed ругается
2. Как советует google fonts через import - page speed ругается
3. через css, скачивая шрифт с fonts.gstatic - не работает в IE11
@font-face{font-family:'Roboto';font-style:normal;font-weight:400;src:local('Roboto'), local('Roboto-Regular'), url(http://fonts.gstatic.com/s/roboto/v15/mErvLBYg_cXG3rLvUsKT_fesZW2xOQ-xsNqO47m55DA.woff2) format('woff2');unicode-range:U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;}
@font-face {
font-family: 'Roboto';
src: url('fonts/robotoregular/roboto-regular-webfont.eot');
src: url('fonts/robotoregular/roboto-regular-webfont.eot?#iefix') format('embedded-opentype'),
url('fonts/robotoregular/roboto-regular-webfont.woff') format('woff'),
url('fonts/robotoregular/roboto-regular-webfont.ttf') format('truetype');
font-weight: 400;
font-style: normal;
}
<script>!function(){function e(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent&&e.attachEvent("on"+t,n)}function t(e){return window.localStorage&&localStorage.font_css_cache&&localStorage.font_css_cache_file===e}function n(){if(window.localStorage&&window.XMLHttpRequest)if(t(o))a(localStorage.font_css_cache);else{var n=new XMLHttpRequest;n.open("GET",o,!0),e(n,"load",function(){4===n.readyState&&(a(n.responseText),localStorage.font_css_cache=n.responseText,localStorage.font_css_cache_file=o)}),n.send()}else{var c=document.createElement("link");c.href=o,c.rel="stylesheet",c.type="text/css",document.getElementsByTagName("head")[0].appendChild(c),document.cookie="font_css_cache"}}function a(e){var t=document.createElement("style");t.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(t)}var o=".fonts.css";window.localStorage&&localStorage.font_css_cache||document.cookie.indexOf("font_css_cache")>-1?n():e(window,"load",n)}();</script>
Answer the question
In order to leave comments, you need to log in
https://habr.com/ru/company/ruvds/blog/437984/
Your question is simply described
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question