您的位置:首页 > Web前端 > JavaScript

js获取web应用的根目录上下文

2017-05-09 15:26 274 查看
function getWebRootPath() {
var 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('/'));
var rootpath="/"+webroot;
return rootpath;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: