var getWebRootPath = function () { var a = window.document.location.href;// var b = window.document.location.pathname; var pos = a.indexOf(b); var path = a.substring(0, pos); a = a.substring(a.indexOf("/") + 2, a.length); a = a.substring(a.indexOf("/") + 1, a.length); var pathName = a.substring(0, a.indexOf("/")); return path + "/" + pathName; }