[英]How to use google web fonts in IE, Firefox and Chrome
I am trying to use google fonts in my web application. 我正在尝试在我的Web应用程序中使用Google字体。 My call to load google fonts is : 我打电话给谷歌字体加载是:
$.get("https://www.googleapis.com/webfonts/v1/webfonts?key=xxxxxxx", function (result) {
var data = {};
console.log(result);
console.log($.parseJSON(result));
data.items = $.parseJSON(result).items;
});
The above call gives following result in my 3 target browsers : 上面的调用在我的3个目标浏览器中给出了以下结果:
Firefox 火狐浏览器
console.log(result); ========> JSON string
console.log($.parseJSON(result)); ========> Successfully parsed the json string
data.items = $.parseJSON(result).items; ===> contains all google fonts
IE (9) IE浏览器 (9)
$.get callback is not executing.
Chrome 铬
console.log(result); ========> Object
console.log($.parseJSON(result)); ========> null
Can anybody please tell me the generalized way to use google fonts on all above 3 mentioned browser? 有人可以告诉我在上述3种浏览器上使用google字体的一般方法吗?
I found a generalized call which works on Firefox, IE and chrome : 我找到了适用于Firefox,IE和chrome的通用调用:
$.ajax({
url: "https://www.googleapis.com/webfonts/v1/webfonts?key=xxxxx",
type: 'GET',
dataType: 'JSONP',
success: function (data) {
// data.items contains all google font-families name
}
});
May this helps to others ! 愿这对别人有帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.