如何重置浏览器';s angular2的导航历史?

如何重置浏览器';s angular2的导航历史?,angular,angular2-routing,Angular,Angular2 Routing,我想清除angular2中的浏览器导航历史记录,以便在用户被导航到特定页面(我感兴趣的页面)后,通过单击“浏览器后退”或“下一步”按钮,应该无法返回或前进 现在我试着像这样导入Angular2位置 import {Location} from "angular2/router"; 这样用它来阻止导航 this._location.replaceState('/'); //clear browser navigation history and reset it to root / thi

我想清除angular2中的浏览器导航历史记录,以便在用户被导航到特定页面(我感兴趣的页面)后,通过单击“浏览器后退”或“下一步”按钮,应该无法返回或前进

现在我试着像这样导入Angular2位置

 import {Location} from "angular2/router";
这样用它来阻止导航

 this._location.replaceState('/'); //clear browser navigation history and reset it to root /
 this._router.navigateByUrl('/home');
注:假设位置和路由器正确注入


但它不起作用。

它看起来不受浏览器支持。看

最近创建了一个问题,以允许传递自定义
HistoryStrategy
,该问题应允许您管理URL被推送到历史记录的方式和时间


另请参见

谢谢。。。我意识到我必须通过注入window对象和实现window.onpopstate事件来实现自己的自定义历史策略。。。谢谢你以后再做。。。