常用的location對象

document.location.host   //表示當前域名 + 端口號
document.location.hostname  //表示域名
document.location.href   //表示完整的URL
document.location.port   //表示端口號
document.location.protocol   //表示當前的網絡協議

document.location.protocol   //表示當前的網絡協議可以解決一些和協議相關的問題(http的請求在https下不安全之類的)

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章