获取当前网址并跳转多个域名

方法一

var hrefValue = window.location.href; 
 alertUrls = ['abc.com', 'edf.com'];  
 for(key in alertUrls){ 
  if(String(hrefValue).indexOf(alertUrls[key]) >= 0){
   break; 
    }else{
 }

 

方法二

 

function tiaozhuan()
{
hrefValue = window.location.href; //获取当前页面的地址
var  alrUrls = ['sm.abc.com', '3g.abv.com', 'm.abc.com']; 
for(var i=0;i<=altUrls.length;i++)
{
if(String(hrefValue).indexOf(altUrls[i]) >= 0)
{
if(altUrls[i]=="sm.hkzhifa.com")
{
//break;
}
else if(altUrls[i]=="3g.hkzhifa.com")
{
//break;
}
                         else{
                              }
}
}
}

 

posted @ 2017-08-20 10:43  风的方向·  阅读(1038)  评论(0编辑  收藏  举报