代码示例:(标识:jsck_location_protocol)
<!DOCTYPE html>
<html>
<body>

<h1>Window Location 对象</h1>

<h2>protocol 属性</h2>

<p id="demo"></p>

<script>
let protocol = location.protocol;
document.getElementById("demo").innerHTML = protocol;
</script>

</body>
</html>
运行结果: