如果我 link 到安装了字体的远程服务器上的外部 CSS。它会嵌入字体吗?
If I link to an external CSS on a remote server with font installed. Will it embed the font?
在服务器上获得许可字体,但页面由供应商在外部托管。
在外部托管页面上,如果我 link 到我服务器上的 CSS 样式表。会嵌入字体吗?
谢谢
答案取决于几件事。
首先-您必须知道远程服务器如何处理远程资产请求。例如,如果远程服务器是 Apache 服务器,并且设置为拒绝通过 .htaccess
对某些非 HTML 页面文件夹的外部请求,它将不起作用。很可能,它不是这样设置的,但您可以通过在浏览器中尝试远程 URL 并查看它是否连接来找出答案。
另一件需要注意的事情是 CORS. If your site is HTTP
and the other is encrypted HTTPS
you could have a cross-origin conflict. One way to avoid that is to use protocol relative URLs,它看起来像://domain.com/your/folders/here
。这通常有助于解决跨源冲突。
到 link 到字体文件使用绝对协议,相对 URLs 与 @font-face
在你的 CSS:
@font-face {
font-family: 'Proxima-Nova';
src: url('//www.example.com/fonts/proximanovaextrabold.eot');
src: url('//www.example.com/fonts/proximanovaextrabold.eot?#iefix') format('embedded-opentype'),
url('//www.example.com/fonts/proximanovaextrabold.woff2') format('woff2'),
url('//www.example.com/fonts/proximanovaextrabold.woff') format('woff'),
url('//www.example.com/fonts/proximanovaextrabold.ttf') format('truetype');
}
在服务器上获得许可字体,但页面由供应商在外部托管。
在外部托管页面上,如果我 link 到我服务器上的 CSS 样式表。会嵌入字体吗?
谢谢
答案取决于几件事。
首先-您必须知道远程服务器如何处理远程资产请求。例如,如果远程服务器是 Apache 服务器,并且设置为拒绝通过 .htaccess
对某些非 HTML 页面文件夹的外部请求,它将不起作用。很可能,它不是这样设置的,但您可以通过在浏览器中尝试远程 URL 并查看它是否连接来找出答案。
另一件需要注意的事情是 CORS. If your site is HTTP
and the other is encrypted HTTPS
you could have a cross-origin conflict. One way to avoid that is to use protocol relative URLs,它看起来像://domain.com/your/folders/here
。这通常有助于解决跨源冲突。
到 link 到字体文件使用绝对协议,相对 URLs 与 @font-face
在你的 CSS:
@font-face {
font-family: 'Proxima-Nova';
src: url('//www.example.com/fonts/proximanovaextrabold.eot');
src: url('//www.example.com/fonts/proximanovaextrabold.eot?#iefix') format('embedded-opentype'),
url('//www.example.com/fonts/proximanovaextrabold.woff2') format('woff2'),
url('//www.example.com/fonts/proximanovaextrabold.woff') format('woff'),
url('//www.example.com/fonts/proximanovaextrabold.ttf') format('truetype');
}