如果window.historylocation来自www.example.com,请采取措施

do something if window.history location is from www.example.com

本文关键字:com 采取措施 example www window historylocation 来自 如果      更新时间:2023-09-26

我们如何确定window.history是否来自某个URL,如www.example.com,然后做一些事情,例如:

if ( //window.history includes example.com string ) { $('.myclassname').hide() }

它实际上需要知道历史的链接位置。。。有办法找到它吗?

您只能通过document.referer获取referer(页面用户来自)。您无法从js访问历史记录。