window 尺寸:
對(duì)于Internet Explorer、Chrome、Firefox、Opera 以及 Safari:(目前主流瀏覽器):
-
window.innerHeight- 瀏覽器窗口的內(nèi)部高度 -
window.innerWidth- 瀏覽器窗口的內(nèi)部寬度
對(duì)于 Internet Explorer 8、7、6、5:
document.documentElement.clientHeight document.documentElement.clientWidth
或者
document.body.clientHeight document.body.clientWidth
Others:
- window.open() - 打開新窗口
- window.close() - 關(guān)閉當(dāng)前窗口
- window.moveTo() - 移動(dòng)當(dāng)前窗口:
window.moveTo(x,y) 兩個(gè)參數(shù) 移動(dòng)到新位置的x,y參數(shù) - window.resizeTo() - 調(diào)整當(dāng)前窗口的尺寸
window Screen:(screen.availWidth 屬性返回訪問者屏幕的寬度,以像素計(jì),減去界面特性,比如窗口任務(wù)欄。)
- screen.availWidth - 可用的屏幕寬度
- screen.availHeight - 可用的屏幕高度
實(shí)例:
document.write("可用高度: " + screen.availHeight);
Window Location:
- location.hostname 返回 web 主機(jī)的域名
- location.pathname 返回當(dāng)前頁(yè)面的路徑和文件名
- location.port 返回 web 主機(jī)的端口 (80 或 443)
- location.protocol 返回所使用的 web 協(xié)議(http:// 或 https://)
Window location Href
document.write(location.href);//返回帶協(xié)議的url
Window Location Assign
location.assign()方法加載新的文檔。在同路徑下進(jìn)入別的文檔
Window History
history.back() 后退
history.forward() 向前
Window Nacigator:
window.navigator 有關(guān)訪問者瀏覽器的信息
類似python爬蟲中的偽造瀏覽器所使用的信息
來自 navigator 對(duì)象的信息具有誤導(dǎo)性,不應(yīng)該被用于檢測(cè)瀏覽器版本,這是因?yàn)椋?/p>
- navigator 數(shù)據(jù)可被瀏覽器使用者更改
- 一些瀏覽器對(duì)測(cè)試站點(diǎn)會(huì)識(shí)別錯(cuò)誤
- 瀏覽器無法報(bào)告晚于瀏覽器發(fā)布的新操作系統(tǒng)