绝对URL忽略协议(方案)以保留当前页面的一个 [英] Absolute URLs omitting the protocol (scheme) in order to preserve the one of the current page

查看:115
本文介绍了绝对URL忽略协议(方案)以保留当前页面的一个的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到了 // somepage.com/resource 网址格式。例如:

 < img src =// remotesite.com/image1.jpg/> 

这一点在于,如果当前页面(定义 img 标签)使用 http ,那么通过http进行对远程站点的请求。如果它是https - 它是https。这消除了未完全加密页面的浏览器警告。



我的问题是 - 此URL格式是否可安全地用于所有浏览器。这是一个标准吗?

解决方案


是这种URL格式可安全地用于所有

我无法确定任何事情,但您应该可以在不同的浏览器中测试它。


这是一个标准吗?


从技术上讲,根据 RFC 3986 ,它被称为网络路径参考。这是它的计划:

  relative-ref = relative-part [?查询] [#片段] 

relative-part =//权限路径abempty
/路径绝对
/路径noscheme
/路径-empty






使用时存在问题在< link> @import ,IE7和IE8下载文件。



以下是由Paul Irish撰写的有关此主题的文章:


I saw the //somepage.com/resource url format. For example:

<img src="//remotesite.com/image1.jpg" />

The point of this is that if the current page (the page defining the img tag) is using http, then the request to the remote site is made via http. If it is https - it's https. This eliminates browser warnings of not fully encrypted pages.

My question is - is this URL format safe to use for all browsers. And is it a standard?

解决方案

is this URL format safe to use for all browsers.

I can't say anything for sure, but you should be able to test it in different browsers.

And is it a standard?

Technically, it is called "network path reference" according to RFC 3986. Here is the scheme for it:

  relative-ref  = relative-part [ "?" query ] [ "#" fragment ]

  relative-part = "//" authority path-abempty
                / path-absolute
                / path-noscheme
                / path-empty


There is a problem though, when used on a <link> or @import, IE7 and IE8 download the file.

Here is a post written by Paul Irish on the subject:

这篇关于绝对URL忽略协议(方案)以保留当前页面的一个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆