简体   繁体   中英

Google Web Fonts not displaying in OSX Safari but do display in Firefox, Chrome, Opera (for OSX, Windows, and Linux) and Internet Explorer

The following website ( http://www.ecu.edu/english/tpc/tpcintern/index.cfm ) is supposed to make use of Google Web Fonts, and the fonts display perfectly in all browsers except Safari. The Javascript used is:

  WebFontConfig = {
    google: { families: [ 'Lato:100:latin' ] }
  };
  (function() {
    var wf = document.createElement('script');
    wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
      '://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
    wf.type = 'text/javascript';
    wf.async = 'true';
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(wf, s);
  })(); 

I realize that the JS doesn't use the tags but I removed them because CommonSpot needs them removed. There are actually a few different Web Fonts being used, but the JS is the same for each with the exception of relevant font information. An example of the CSS is this:

#navigation {
 font-family: 'Lato', sans-serif;
 font-size: 1.3em;
 font-style: normal;
 float: left;
 margin: .5em 0 0 .5em;
 width: 70%;
 height: 2em;
 position: relative;
 padding: .5em 0;
 text-transform: uppercase;
 font-size: 1em;
 background-color: #592a8a;
}

Finally, the web fonts are hosted by Google, if that makes a difference (I wouldn't think that it would, being as they seem to be working in other browsers?).

There was a problem with CommonSpot and how it handles JavaScript. For anyone else who uses CommonSpot, just create a separate HTML file with the JavaScript, upload it to the CustomCF folder, and attach it through CommonSpot.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM