如何在javascript中查看历史对象的内容? [英] How to view the contents of history object in javascript?

查看:81
本文介绍了如何在javascript中查看历史对象的内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

历史记录对象包含用户访问的URL(在浏览器窗口内)。如何查看访问的URL?我尝试安慰对象,并检查了所有字段,找不到所需的数据。 history.back()将加载先前的URL,但我只想知道先前的URL。

The history object contains the URLs visited by the user (within a browser window). How do I view the visited URLs? I tried consoling the object and checked through all the fields, couldn't find the required data. history.back() will load the previous, but I just want to know the previous URL.

推荐答案

您不能执行此操作。
是出于安全原因而制作的。
但是,您可以通过选中 document.referrer 来查看最后一个(您来自的页面)。
查看更多此处

You cannot do this. It's made for security reasons. However you can view the last one (page which you came from) by checking document.referrer. See more here

这篇关于如何在javascript中查看历史对象的内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆