0

window.onhashchange will be triggered when the event is fired.

Can I ask client whether to change before onhashchange?

Something like onbeforeunload.

Thanks in advance.

4

1 回答 1

0

你可以模拟一下。您将当前值存储window.location.hash在某个变量 H 中。在处理程序中onhashchange弹出您想要的任何警报,然后根据用户的响应,将新值保存到 H(如果用户确认)或将其重置为 H 中的先前值(如果用户取消)。你想要这样的行为吗?

于 2013-09-25T10:40:27.753 回答