如何使用jQuery或纯JavaScript将用户从一个页面重定向到另一个页面?
我有一个问题:我想通过JavaScript重定向到上面的目录.我的代码:
location.href = (location.href).substr(0, (location.href).lastIndexOf('folder'));
Run Code Online (Sandbox Code Playgroud)
网址如下所示:
example.com/path/folder/index.php?file=abc&test=123&lol=cool
重定向会影响到这个:
example.com/path/&test=123&lol=cool
但想拥有这个:
example.com/path/
我怎么能这样做?