获取当前请求路径var href = location.href ;if(href.indexOf("baidu")>-1){//跳转location.href = "http://baidu.com";}