ITeye博客

js获取网站路径

gaoke · 2013-04-02 11:36 · JS · Web前端 · Markdown

var tempContext;
     var tempPathName = window.location.pathname;
     tempContext = tempPathName.substring(1,tempPathName.length);
     context = tempContext.substring(0,tempContext.indexOf("/"));
     path = window.location.protocol+"//"+window.location.host+"/"+context;

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。