如何获取当前页面上一页的网址? [英] How to get url of previous page on current page?

查看:73
本文介绍了如何获取当前页面上一页的网址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何通过变量访问上一页网址?



我可以使用该变量来比较网址吗?



假设

i want to know how to access previous page URL through variable??

can i use that variable to compare a URL ??

suppose

var oldUrl = "www.google.com";

if (oldUrl =  "www.google.com")

{
 do some thing

}





场景如上所述是可能的?



scenario like above is possible??

推荐答案

如评论中所述,你可以使用document.referrer属性但检查为null,因为它并不总是被填充。
As mentioned in the comments, you can use document.referrer property but check for null since it is not always filled in.


这篇关于如何获取当前页面上一页的网址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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