//js webcontextvar webroot=document.location.href;webroot=webroot.substring(webroot.indexOf("//")+2,webroot.length); webroot=webroot.substring(webroot.indexOf("/")+1,webroot.length);webroot=webroot.substring(0,webroot.indexOf("/"));rootpath="/"+webroot;以上这篇js 获取当前web应用的上下文路径实现方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持脚本之家。