It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center。
已关闭8年。
我刚刚开始测试“协议(protocol)减少Urls”背后的想法。
我要解决的问题是:https页面上的我需要从http加载外部CSS文件。
以“正常”方式执行此操作会导致失败... css文件被阻止。 (现在仅测试chrome)。
所以我的问题是:是否“protocol less Urls”会从http/https/both加载文件? Is it valid to replace http:// with // in a <script src="http://...">? Can I change all my http:// links to just //?
已关闭8年。
我刚刚开始测试“协议(protocol)减少Urls”背后的想法。
我要解决的问题是:https页面上的我需要从http加载外部CSS文件。
以“正常”方式执行此操作会导致失败... css文件被阻止。 (现在仅测试chrome)。
所以我的问题是:是否“protocol less Urls”会从http/https/both加载文件?
最佳答案
如果您指的是www.example.com/style.css
之类的URL,则由于协议(protocol)完全丢失而无法使用。浏览器会将www.example.com
视为某种目录路径名。
如果您指的是//www.example.com/style.css
之类的URL,则这是协议(protocol)相对URL;它使用与浏览器已用于请求引用页面的协议(protocol)相同的协议(protocol)。例如,如果浏览器请求了带有https://www.example.com
的页面,则将通过HTTPS而非HTTP请求该URL。
浏览器对这些URL的支持通常相当不错。看到以下问题: