Is it possible to e.preventDefault in [removed]?

后端 未结 2 1249
刺人心
刺人心 2021-01-08 00:21

I\'m trying to stop the user from going back in my web app. For this I tried catching the window.onpopstate and added e.preventDefault to cancel th

2条回答
  •  北荒
    北荒 (楼主)
    2021-01-08 01:12

    According to this documentation, the popstate event is not cancellable:

    Specification: HTML5
    Interface: PopStateEvent
    Bubbles: Yes
    Cancelable: No
    Target: defaultView
    Default Action: None

提交回复
热议问题