页面网址是http://example.com/dashboard#/catalog。Cookie过期后,我会执行
res.redirect('/login')
Run Code Online (Sandbox Code Playgroud)
浏览器中的结果网址为http://example.com/login#/catalog。
我如何在没有哈希部分的情况下重定向,即使网址成为 http://example.com/login
谢谢你的帮助!!
我不知道你是如何做注销部分的,但假设你使用的是链接标签,你可以做这样的事情
$("a#logout").on('click', function() {
// the following was taken from http://stackoverflow.com/questions/4508574/remove-hash-from-url
var loc = window.location.href,
index = loc.indexOf('#');
if (index > 0) {
window.location = loc.substring(0, index);
}
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1134 次 |
| 最近记录: |