【问题标题】:Fontello rendering on iOS, but not Android and desktop browsersFontello 在 iOS 上渲染,但不在 Android 和桌面浏览器上
【发布时间】:2015-11-10 13:18:59
【问题描述】:

我有一个问题,我的 Fontello 自定义下载在 iOS 的 Chrome 和 Safari 上加载,但在 Android 或桌面浏览器上没有加载(调整窗口大小时)。该字体用于每个帖子中移动共享按钮中的图标。

网址:http://www.mtscollective.com

标记:

<div>
    <ul class='mobile-share-bar'>
        <li><script>
            var strPostUrl = "<data:post.url/>";
            document.write("<a class='mobile-share-button icon-facebook' href='http://www.facebook.com/sharer.php?u="+strPostUrl+"' id='fb-mobile-button' target='_blank'><span class='share-text'>Share</span></a>");
        </script></li>

        <li><script>
            var strPostUrl = "<data:post.url/>";
            var strPostTitle = '<data:post.title/>';
            document.write("<a class='mobile-share-button icon-twitter' href='https://twitter.com/share?text="+strPostTitle+"&amp;url="+strPostUrl+"&amp;via=MTS_Collective' id='twitter-mobile-button' target='_blank'><span class='share-text'>Share</span></a>");
        </script></li>

        <li><script>
            var strPostUrl = "<data:post.url/>";
            var strPostTitle = '<data:post.title/>';
            var strNewUrl = strPostUrl.replace("http://","");
            var strNewTitle = strPostTitle.replace(/"/g, '"');
            document.write("<a class='mobile-share-button icon-tumblr' href='http://www.tumblr.com/share/link?url="+strNewUrl+"&amp;name="+strNewTitle+"' id='tumblr-mobile-button' target='_blank'><span class='share-text'>Share</span></a>");
        </script></li>
    </ul>
</div>

CSS:

@import url(http://fonts.googleapis.com/css?family=Oswald);

    @font-face {
        font-family: 'fontello';
        src: url('http://cdn.mtscollective.com/fontello/font/fontello.eot?4448318');
        src: url('http://cdn.mtscollective.com/fontello/font/fontello.eot?4448318#iefix') format('embedded-opentype'),
            url('http://cdn.mtscollective.com/fontello/font/fontello.woff?4448318') format('woff'),
            url('http://cdn.mtscollective.com/fontello/font/fontello.ttf?4448318') format('truetype'),
            url('http://cdn.mtscollective.com/fontello/font/fontello.svg?4448318#fontello') format('svg');
        font-weight: normal;
        font-style: normal;
    }

    [class^="icon-"]:before, [class*=" icon-"]:before
    {
        font-family: "fontello";
        color: #fff;
        font-style: normal;
        font-weight: normal;
        speak: none;
        display: inline-block;
        text-decoration: inherit;
        width: 1em;
        text-align: center;
        font-variant: normal;
        text-transform: none;
        line-height: 1em;
        margin-right: .3em;
    }

    .icon-facebook:before
    {
        content: '\e806';
    }

    .icon-twitter:before
    {
        content: '\e809';
    }

    .icon-tumblr:before
    {
        content: '\e808';
    }

我真的不确定是什么让它无法在任何地方工作。我已经清除了 iOS 上的缓存,以确保它正在读取最新的代码。

任何帮助将不胜感激!

【问题讨论】:

    标签: html css fontello


    【解决方案1】:

    无法在 OS X 上的 Chrome 中加载。控制台显示:Font from origin 'http://cdn.mtscollective.com' has been blocked from loading by Cross-Origin Resource Sharing policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://www.mtscollective.com' is therefore not allowed access.

    看起来您可能遇到与此问题相同的问题:Font Awesome icons not showing in Chrome, a MaxCDN related Cross-Origin Resource Sharing policy issue

    我会看看这个答案:https://stackoverflow.com/a/26521650/4556503

    您需要修改您的.htaccess 以允许跨域请求。

    【讨论】:

    • 啊,是的。虽然我从未修改过 .htcaccess 文件,但我看到了这个问题。我将不得不做更多的谷歌搜索。谢谢!
    • 没问题。如果您遇到困难,我们会在这里!
    猜你喜欢
    • 2013-01-11
    • 2013-08-26
    • 2014-08-14
    • 2016-05-07
    • 2016-11-24
    • 1970-01-01
    • 1970-01-01
    • 2013-11-28
    • 2014-06-08
    相关资源
    最近更新 更多