如何通过js获取当前文件上下文路径.txt?

更新于
2026-09-29 09:46:37
0阅读来源:SEO资源
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计102个文字,预计阅读时间需要1分钟。

如何通过js获取当前文件上下文路径.txt?

javascript// 获取上下文路径function webContext() { var curWwwPath=window.document.location.href; var pathName=window.document.location.pathname; var pos=curWwwPath.indexOf(pathName); var projectPath=curWwwPath.substring(0, pos); return projectPath;}

如何通过js获取当前文件上下文路径.txt?

js 获得上下文路径.txt

//获得项目地址栏路径,根据需要增加 function webContext(){ var curWwwPath=window.document.location.href; var pathName=window.document.location.pathname; var pos=curWwwPath.indexOf(pathName); var localhostPaht=curWwwPath.substring(0,pos); var projectName=pathName.substring(0,pathName.substr(1).indexOf('/')+1); return(localhostPaht+projectName); }

本文共计102个文字,预计阅读时间需要1分钟。

如何通过js获取当前文件上下文路径.txt?

javascript// 获取上下文路径function webContext() { var curWwwPath=window.document.location.href; var pathName=window.document.location.pathname; var pos=curWwwPath.indexOf(pathName); var projectPath=curWwwPath.substring(0, pos); return projectPath;}

如何通过js获取当前文件上下文路径.txt?

js 获得上下文路径.txt

//获得项目地址栏路径,根据需要增加 function webContext(){ var curWwwPath=window.document.location.href; var pathName=window.document.location.pathname; var pos=curWwwPath.indexOf(pathName); var localhostPaht=curWwwPath.substring(0,pos); var projectName=pathName.substring(0,pathName.substr(1).indexOf('/')+1); return(localhostPaht+projectName); }