1. 程式人生 > >js判斷url換主域名進行鏈接跳轉

js判斷url換主域名進行鏈接跳轉

index code str style pre log sta spa www.

    //跳轉代碼
   var Url001 = window.location.href;
   var arrUrl = Url001.split("//");
   var start = arrUrl[1].indexOf("/");
   var relUrl = arrUrl[1].substring(start); 
   window.location.href ="http://www.baidu.com"+relUrl;

js判斷url換主域名進行鏈接跳轉