绝对路径:
类似:location.href = https://www.baidu.com/a/b/c
使用绝对路径跳转,页面返回后刷新,导致无法定位到当时跳转到位置。
相对路径:
相对路径又分为两种情况:
使用location.href以及<a href=“” />进行跳转的时候,有两种:
<a href = “/2022/bbs/tid” />和
<a href=“2022/bbs/tid” />
假如当前网页地址:https://bbs.hupu.com:8080/home
则第一种跳转到:https://bbs.hupu.com:8080/2022/bbs/tid
第二种跳转到:https://bbs.hupu.com:8080/home/2022/bbs/tid