getting last page URL from history object - cross browser?

后端 未结 2 1373
南笙
南笙 2020-12-04 01:58

Is it possible to get last page URL from the history object? I\'ve come accross history.previous but that\'s either undefined or protected from what I\'ve s

相关标签:
2条回答
  • 2020-12-04 02:23

    Not from the history object, but from document.referrer. If you want to get the last actual page visited, there is no cross-browser way without making a separate case based on support for each property.

    0 讨论(0)
  • 2020-12-04 02:31

    You cant get to history in any browser. That would be a serious security violation since that would mean that anyone can snoop around the history of their users.

    You might be able to write a Browser Helper Object for IE and other browsers that give you access to that. (Similar to the google toolbar et al). But that will require the users to allow that application to run on their machine.

    There are some nasty ways you can get to some history using some "not-so-nice" ways but I would not recommend them. Look up this link.

    0 讨论(0)
提交回复
热议问题