跳转
本页跳转
location.href = ""
不能回退
location.replace("");
history.back() = history.go(-1)
history.forward() = history.go(1)
window.history.back();
window.history.forward();
window.location.href
"https://www.baidu.com/?tn=02049043_8_pg&ch=2"
window.location
1.
ancestorOrigins: DOMStringList {length: 0}
2.
assign: ƒ assign()
3.
hash: ""
4.
host: "github.com"
5.
hostname: "github.com"
6.
href: "https://github.com/enterprise"
7.
origin: "https://github.com"
8.
pathname: "/enterprise"
9.
port: ""
10.
protocol: "https:"
11.
reload: ƒ reload()
12.
replace: ƒ replace()
13.
search: ""
14.
toString: ƒ toString()
15.
valueOf: ƒ valueOf()
16.
Symbol(Symbol.toPrimitive): undefined
17.
__proto__: Location
refer 是网页来源
window.history
1.
length: 15
2.
scrollRestoration: "auto"
3.
state: null
4.
__proto__: History
1.
back: ƒ back()
2.
forward: ƒ forward()
3.
go: ƒ go()
4.
length: (...)
5.
pushState: ƒ pushState()
6.
replaceState: ƒ replaceState()
7.
scrollRestoration: (...)
8.
state: (...)
9.
constructor: ƒ History()
10.
Symbol(Symbol.toStringTag): "History"
11.
get length: ƒ length()
12.
get scrollRestoration: ƒ scrollRestoration()
13.
set scrollRestoration: ƒ scrollRestoration()
打开新浏览器窗口(不是标签页)
QQ浏览器不管,是打开的标签页. 谷歌浏览器可以
window.open("https://www.baidu.com",""," height=380,width=320,toolbar=0,scrollbars=0, location=0,status=0,menubar=0,resizable=0 ");
confirm
<script type="text/javascript">
var flag=confirm("确认要删除此条信息吗?");
if(flag==true)
alert("删除成功!");
else
alert("你取消了删除");
</script>
评论区