Location protocol 屬性

定義和用法
protocol 屬性是一個可讀可寫的字符串,可設置或返回當前 URL 的協(xié)議。
語法
location.protocol
瀏覽器支持
所有主要瀏覽器都支持 protocol 屬性
實例
實例
返回當前URL的協(xié)議部分:
<script>
document.write(location.protocol);
</script>
document.write(location.protocol);
</script>
以上實例輸出結果:
document.write(location.protocol);
嘗試一下 ?

更多建議: