gpt4 book ai didi

css - 通过重定向的外部网络字体

转载 作者:太空宇宙 更新时间:2023-11-04 12:16:50 27 4
gpt4 key购买 nike

当尝试在网页上使用来自另一个域的字体文件时,我遇到了 Cross Origin Resource Policy 的限制。

因此,我没有使用 @font-face 直接从 CSS 引用外部字体 URL,而是引用了一个重定向到外部字体资源的本地 URL 路径。我认为浏览器可能会将字体视为同域资源。事实上,重定向似乎让 Chrome 浏览器使用了外部字体,但 Firefox 却不是这样,它不允许这样做。

我的问题是,Chrome 和 Firefox 分别展示的两种行为中,哪一种是符合标准的?

最佳答案

发件人:http://www.w3.org/TR/cors/#cors-api-specification-redirect

Since browsers are based on a same origin security model and the policy outlined in this specification is intended for APIs used in browsers, it is expected that APIs that will utilize this policy will have to handle a same origin request that results in a redirect that is cross-origin in a special way.

For APIs that transparently handle redirects CORS API specifications are encouraged to handle this scenario transparently as well by "catching" the redirect and invoking the cross-origin request algorithm on the (cross-origin) redirect URL.

据我所知,Firefox 似乎“以正确的方式”处理了它。

关于css - 通过重定向的外部网络字体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28643237/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com