var url=window.location.href; //获取url
if(url.indexOf("code") >= 0 ) { //判断url地址中是否包含code字符串
alert("包含code");
}else {
alert("不包含code");
//页面跳转
}
判断url地址中是否包含某个字符串
最新推荐文章于 2022-11-28 14:43:06 发布
var url=window.location.href; //获取url
if(url.indexOf("code") >= 0 ) { //判断url地址中是否包含code字符串
alert("包含code");
}else {
alert("不包含code");
//页面跳转
}