JS_外部对象_window

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>location地址栏</title>
<script type="text/javascript">
//location 地址栏对象
function f1() {
var b=confirm("你确定离开本页面么???")

if(b){
//跳转
location.href="http://www.baidu.com";
}
}
function f2() {
//刷新
location.reload();
}
//screen 屏幕对象
function f3() {
console.log(screen.width);
console.log(screen.height);
console.log(screen.availWidth);
console.log(screen.availHeight);
}
//history 历史对象
function f4() {
history.forward()
}
//navigator对象
function f5() {
console.log(navigator.userAgent);
}
</script>
</head>
<body>
<input type="button" value="百度"
onclick="f1();">
<input type="button" value="刷新"
onclick="f2();">
<input type="button" value="屏幕"
onclick="f3();">
<input type="button" value="前进"
onclick="f4();">
<input type="button" value="帮助"
onclick="f5();">

</body>
</html>

原文地址:https://www.cnblogs.com/Bighua123/p/7634368.html