Firefox 中的 iframe 中不显示字体
我有一个带有 iframe 的页面。 iframe 内容来自其他域,但我有一个 css 文件包含在该域的 head
中,因此两者具有相同的样式,而且确实如此。除了带有特殊字体的标题h1
。它可以在 Chrome、Opera、IE 和 Safari 中正确显示,但不能在 Firefox 中显示:( 它会退回到 Arial。
@font-face {
font-family: 'TheSansLight';
src: url('ABSOLUTEPATH/fonts/TheSans_TT3_.eot?iefix') format('ie9-skip-eot'),
url('ABSOLUTEPATH/fonts/TheSans_TT3_.woff') format('woff'),
url('ABSOLUTEPATH/fonts/TheSans_TT3_.svg#TheSans_TT3_') format('svg');
}
后来在 css 中
font-family: "TheSansLight", Arial, Helvetica, Verdana, sans-serif;
显示。大家知道为什么 Firefox 不会在 iframe 中渲染字体吗?
I have page with an iframe. Iframe content comes from other domain, but I have one css file that is included in head
in that domain so both has same style, and it is. except for headlines h1
with special font. It is shown properly in Chrome, Opera, IE and Safari, but not in Firefox :( It falls back to Arial.
@font-face {
font-family: 'TheSansLight';
src: url('ABSOLUTEPATH/fonts/TheSans_TT3_.eot?iefix') format('ie9-skip-eot'),
url('ABSOLUTEPATH/fonts/TheSans_TT3_.woff') format('woff'),
url('ABSOLUTEPATH/fonts/TheSans_TT3_.svg#TheSans_TT3_') format('svg');
}
and later in css
font-family: "TheSansLight", Arial, Helvetica, Verdana, sans-serif;
Does enyone has any idea why firefox would not render font inside iframe?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Firefox 对 @font-face 有一个跨域策略,除非远程主机特别允许,否则它会阻止它们。 Google 提供了许多使用 Apache 配置解决此问题的教程,例如:
http://www.cssbakery.com/2010/07/fixing-firefox-font-face-cross-domain_25.html
Firefox has a cross-domain policy for @font-face which blocks them unless specifically allowed on the remote host. Google turns up any number of tutorials for working around it with Apache config, such as this one:
http://www.cssbakery.com/2010/07/fixing-firefox-font-face-cross-domain_25.html