如何做window.location.href
法官?
如果window.location.href
不匹配?search=
,则使当前url跳转到http://localhost/search?search=car
我的代码不起作用,还是我应该indexOf
用来做判断?谢谢。
if(!window.location.href.match('?search='){
window.location.href = 'http://localhost/search?search=car';
}