eg: http://write.blog.csdn.net/postedit?ref=toolbar 获取到http://write.blog.csdn.net
function getPath() {
var strFullPath = window.document.location.href;
var strPath = window.document.location.pathname;
var pos = strFullPath.indexOf(strPath);
var prePath = strFullPath.substring(0, pos);
return prePath;
}
$(document).ready(function () {
alert(getPath());
});