HTML DOM protocol 屬性
定義和用法
protocol 屬性是一個可讀可寫的字符串,可設(shè)置或返回當(dāng)前 URL 的協(xié)議。
語法
location.protocol=path
實例
假設(shè)當(dāng)前的 URL 是: http://example.com:1234/test.htm#part2:
<html> <body> <script type="text/javascript"> document.write(location.protocol); </script> </body> </html>
輸出:
http: