Location protocol 属性

Location protocol 属性

定义和用法

protocol 属性是一个可读可写的字符串,可设置或返回当前 URL 的协议。

语法

location.protocol
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
</head>
<body>

<script>
document.write(location.protocol);
</script>

</body>
</html>

结果;https:

原文地址:https://www.cnblogs.com/lxwphp/p/15453813.html