English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
protocol属性设置或返回当前URL的协议,包括冒号(:)。
返回协议属性:
location.protocol
设置协议属性:
location.protocol = protocol
var x = location.protocol; document.querySelector("#output").innerHTML = x;Testen Sie heraus‹/›
所有浏览器都完全支持protocol属性:
属性 | |||||
protocol | 是 | 是 | 是 | 是 | 是 |
值 | 描述 |
---|---|
protocol | 字符串,指定URL的协议 可能的值:
|
返回值: | 一个字符串,表示当前URL的协议,包括冒号(:) |
---|
Dieser Beispiel zeigt alle Positionseigenschaften:
var txt = ""; txt += "<p>Host: " + location.host + "</p>"; txt += "<p>Hostname: " + location.hostname + "</p>"; txt += "<p>Href: " + location.href + "</p>"; txt += "<p>Ursprung: " + location.origin + "</p>"; txt += "<p>Pfadname: " + location.pathname + "</p>"; txt += "<p>Protokoll: " + location.protocol + "</p>"; txt += "<p>Search: " + location.search + "</p>"; document.write(txt);Testen Sie heraus‹/›
Position Referenz:location.href-Eigenschaft
Position Referenz:location.host-Eigenschaft
Position Referenz:location.origin-Eigenschaft