我在网页上使用谷歌字体,但该字体是通过http调用的 -
<link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
如果通过 https 请求页面 - 字体将被识别为不安全内容。
如何请求
<link href='https://fonts.googleapis.com/css
仅当通过 https 连接请求页面时,如果请求 http,则提供 http 服务?
最佳答案
删除http:
,这将使URL相对于当前方案
<link href='//fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
关于javascript - 仅当请求 https 页面时,才通过 https href google 字体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19274868/