1. 程式人生 > >JavaScript 瀏覽器對象

JavaScript 瀏覽器對象

click oct navigator 框架 itl 新的 tor ssi meta

bom 把瀏覽器看成一個對象,是操作瀏覽器

dom是操作瀏覽器的內容

頁面的文檔對象
console.log(window.document);
瀏覽器的框架
console.log(window.frames);
瀏覽器的信息
console.log(window.navigator);
屏幕的信息
console.log(window.screen);

href屬性 控制瀏覽器地址內容
reload 刷新頁面
reload(true) 刷新頁面,不帶緩存
assign 加載新的頁面
replace() 加載新的頁面不會在歷史記錄留下記錄
connsole.log(window.locationn);
console.log(window.history);


======================================================
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<script src="js/test.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<button>按鈕</button>
<button onclick="func()">跳轉到紅頁面</button>



</body>
</html>


================================
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<script src="js/test.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<button>按鈕</button>
<button onclick="func()">跳轉到紅頁面</button>



</body>
</html>


================================
function func(){
console.log("點我幹嘛")
// 跳轉到red。html
// window.location.href = "red.html"
// window.location.reload()
window.location.assign("red.html")
}
console.log(window.document);
console.log(window.frames);
console.log(window.navigator);
console.log(window.screen);
console.log(window.locationn);
console.log(window.history);
console.log(window,location)
















JavaScript 瀏覽器對象