0

I have a website:

http://seachangesalt.com/

This website has two aliases:

It links to the same website, same back-end information. In FireFox the alias menu's and banner's font and css seem to change. They are bigger and the menu is even pushed so far that it cuts of 2-3 menu items.

Why would this happen if they are both the same website with just alias? The site is built in WordPress but I don't think that has anything to do with it.

Edit: I stand corrected this also happens in IE. Chrome is the only one getting it correctly.

4

2 回答 2

0

您的问题是您使用绝对路径链接到字体的 css 文件,但 css 文件本身包含相对路径。因此浏览器将尝试从与当前别名不同的域名中提取文件。一些浏览器试图通过在某些情况下不允许跨服务器漏洞来避免这种情况。将绝对路径更改为相对路径,您的问题就会消失。

改变这个:

<link rel='stylesheet' id='customfont-css'  href='http://SeaChangeSalt.com/wp-content/themes/zenon/fonts/yanone_kaffeesatz.css?ver=3.5.1' type='text/css' media='all' />

对此:

<link rel='stylesheet' id='customfont-css'  href='wp-content/themes/zenon/fonts/yanone_kaffeesatz.css?ver=3.5.1' type='text/css' media='all' />

因此,查看您用于 Wordpress 的主题进入文件:

编辑

/wp-content/themes/zenon/functions.php

使用绝对 url 更改请求字体样式表的这一行:

wp_enqueue_style('customfont',get_template_directory_uri().'/fonts/'.$zn_fonts = of_get_option('font_select', 'yanone_kaffeesatz' ).'.css');

并使用 wp 的功能通过将行更改为以下内容来从完整的主题 url 中制作一个临时的相对 url:

wp_enqueue_style('customfont',wp_make_link_relative(get_template_directory_uri()).'/fonts/'.$zn_fonts = of_get_option('font_select', 'yanone_kaffeesatz' ).'.css');

我相信这是强制 wordpress 为该字体的样式表输出正确的相对 url 的一种方法。

于 2013-08-29T16:08:20.803 回答
0

我们为它做了一个 htaccess 编辑。

   <FilesMatch "\.(ttf|otf|eot)$">
        <IfModule mod_headers.c>
            Header set Access-Control-Allow-Origin "*"
        </IfModule>
    </FilesMatch>
于 2013-09-11T15:23:00.837 回答