Can we get browser history by using Javascript?

橙三吉。 提交于 2019-11-27 22:57:30

You can make use of History object of javascript to do that

The history property has the return value as history object, which is an array of history items having details of the URL's visited from within that window. Also, note that the History object is a JavaScript object and not an HTML DOM object.

syntax of history property of Window Object:

window.history 
Riz

If you are looking a way to navigate in browser history URLs. These links would be helpful.

For privacy reasons, no it is not possible to read clients browser history data.

If you are trying to observe or generate data about visitors for only on your domain, its possible to keep page information with sessions and cookies.

you can also collect click data on your websites clickable objects by your own scripts which are sending the data by ajax requests.

if you are running a one page application type website and generating your own url's width "pushState" function, you just need to add some extra code to collect that data and send the information with ajax on page/url changes.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!