JS仅在域时如何知道当前文件名

问题描述 投票:0回答:1

使用[[window.location.pathname作为页面https://google.com/home.html的结果将是“ / home.html”] >>URL中不存在文件名时,例如https://google.com/结果将为

“ /”

在检查员来源中为索引

enter image description here

是否可以获取当前文件名

使用https://google.com/home.html页面的window.location.pathname使用url中不存在文件名时的结果为“ /home.html”。 https://google.com/结果在来自...的源中将为“ /”]]

javascript pathname
1个回答
0
投票
编号

浏览器无法了解HTTP服务器将路径转换为资源的过程。

© www.soinside.com 2019 - 2024. All rights reserved.