js文件中获取项目访问路径加载资源文件

getRootPath()+"static/html/projecthelp.html"    ;

function getRootPath() {

    var pathName = window.location.pathname.substring(1);

    var webName = pathName == '' ? '' : pathName.substring(0, pathName.indexOf('/'));

    return window.location.protocol + '//' + window.location.host + '/' + webName + '/';

}

猜你喜欢

转载自blog.csdn.net/wgd930701/article/details/81022218