简体   繁体   English

如何在IE,Firefox和Chrome中使用Google网络字体

[英]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.

相关问题 Google Web Map复选框在Firefox和Chrome中有效,但在IE中不起作用 - Google Web Map checkboxes work in Firefox & Chrome, but do not function in IE 如何在 VueJS 应用程序中使用 Google Web 字体? - How to use Google Web Fonts in VueJS app? 适用于谷歌浏览器,但不适用于Firefox和IE浏览器 - Works for google chrome but not for firefox and IE Google Web字体不在OSX Safari中显示,但在Firefox,Chrome,Opera(用于OSX,Windows和Linux)和Internet Explorer中显示 - Google Web Fonts not displaying in OSX Safari but do display in Firefox, Chrome, Opera (for OSX, Windows, and Linux) and Internet Explorer Chrome和Google网络字体出现问题。 显示来自Firefox的不同输出 - Problem with Chrome and Google web fonts. Showing different output from Firefox SVG不在Firefox中渲染字体(适用于IE9和Chrome) - SVG doesn't render fonts in Firefox (works in IE9 and Chrome) 如何强制Google Chrome / Firefox使用Internet Explorer Web浏览器控件 - how to force google chrome/firefox to use Internet explorer web browser control Web 服务在 chrome 中工作正常,但在 Firefox 和 IE 中不工作 - Web service work fine in chrome, but not in firefox and IE IE VS Chrome和Firefox中的网络安全(bug) - Web Security in IE VS Chrome & Firefox (bug) 谷歌地图标记出现在Chrome中,但不出现在Firefox或IE中 - Google Map Markers Appear in Chrome but not in Firefox or IE
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM