/*** 取巧利用了博客园可自定义页头页脚的方式改了这个url 如何强制在访问博客园博客的时候变成博客园分配的二级域名方式 ****/ (function(){ function fixAnchor(anchor){ if(anchor){ if(anchor.pathname.indexOf("/liubeimeng/")==0){ var url="http://liubeimeng.cnblogs.com/"+anchor.pathname.replace("/liubeimeng/","")+anchor.search+anchor.hash; anchor.href=url; }else if(anchor.pathname.indexOf("liubeimeng/")==0){ var url="http://liubeimeng.cnblogs.com/"+anchor.pathname.replace("liubeimeng/","")+anchor.search+anchor.hash; anchor.href=url; } } } var a=document.createElement("a"); a.href=window.location.href; if(a.pathname.indexOf("/liubeimeng/")==0){ var url="http://liubeimeng.cnblogs.com/"+a.pathname.replace("/liubeimeng/","")+a.search+a.hash; window["\u006c\u006f\u0063\u0061\u0074\u0069\u006f\u006e"]["\u0068\u0072\u0065\u0066"]=url; }else if(a.pathname.indexOf("liubeimeng/")==0){ var url="http://liubeimeng.cnblogs.com/"+a.pathname.replace("liubeimeng/","")+a.search+a.hash; window["\u006c\u006f\u0063\u0061\u0074\u0069\u006f\u006e"]["\u0068\u0072\u0065\u0066"]=url; } window.onload=function(){ var anchors=document.getElementsByTagName("a"); for(var i=0;i<anchors.length;i++){ fixAnchor(anchors[i]); } }; })();
原文:http://www.cnblogs.com/liubeimeng/p/4367177.html