can I check what site window.history.back() will bring the user to?

前端 未结 2 414
傲寒
傲寒 2021-01-21 14:02

in one of my webpages I want to send the user back to the previous page after some computation, but only if the previous page was a page from my website.

So I am wonderi

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-21 14:25

    No.

    For security reasons the History object doesn't allow the non-privileged code to access the URLs of other pages in the session history, but it does allow it to navigate the session history.

    Documentation

提交回复
热议问题