链接以两个斜线开始 [英] Links start with two slashes

查看:119
本文介绍了链接以两个斜线开始的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

越来越多的人开始注意到网站源代码中的链接以两个斜杠开头。例如:

 < a href =// example.com/1.png\"> Image< ;; a> 

为什么会这样?

解决方案

这是一个协议相对URL (通常是HTTP或HTTPS)。因此,如果我位于 http://example.org ,并且链接(或包含图片,脚本等)到 //示例.com / 1.png ,它会转到 http://example.com/1.png 。如果我位于 https://example.org ,它会转到 https://example.com/1.png

这可以让您轻松避免混合内容安全错误。


More and more, began to notice that the links in the source code on Web sites begin with two slashes. For example:

<a href="//example.com/1.png">Image</a>

Why do it?

解决方案

It's a protocol-relative URL (typically HTTP or HTTPS). So if I'm on http://example.org and I link (or include an image, script, etc.) to //example.com/1.png, it goes to http://example.com/1.png. If I'm on https://example.org, it goes to https://example.com/1.png.

This lets you easily avoid mixed content security errors.

这篇关于链接以两个斜线开始的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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