Window location.protocol
描述
protocol 屬性用於設定或返回當前 URL 的協議,包括冒號(:)。
協議是規定資料如何在計算機之間傳輸的標準。
語法
返回 protocol 屬性
location.protocol
設定 protocol 屬性
location.protocol = protocol
屬性值
引數 | 描述 |
protocol | URL 的協議。示例
|
返回值
型別 | 描述 |
一個字串 | 當前 URL 的協議,包括冒號(:) |
瀏覽器支援
location.protocol
在所有瀏覽器中都受支援
Chrome | Edge | Firefox | Safari | Opera | IE |
是 | 是 | 是 | 是 | 是 | 是 |