Javascript history.pushState不更新“的url”;分享……”;移动Chrome上的按钮

Javascript history.pushState不更新“的url”;分享……”;移动Chrome上的按钮,javascript,html,google-chrome,pushstate,html5-history,Javascript,Html,Google Chrome,Pushstate,Html5 History,我正在使用history.pushState更新URL,如下所示: var state = {url: newLocation}; window.history.pushState(state, pagetitle, newLocation); 在移动Chrome上,网页URL(在URL栏上)和标题会按预期更新。但是当点击Chrome菜单上的“共享…”按钮时,旧的URL(在调用history.pushState之前)会被共享。我是否遗漏了什么?我如何修复它?谢谢 我发现rel=“can

我正在使用history.pushState更新URL,如下所示:

var state = {url: newLocation};
window.history.pushState(state, pagetitle, newLocation);    
在移动Chrome上,网页URL(在URL栏上)和标题会按预期更新。但是当点击Chrome菜单上的“共享…”按钮时,旧的URL(在调用history.pushState之前)会被共享。我是否遗漏了什么?我如何修复它?谢谢

我发现rel=“canonical”url也应该更新

$('link[rel="canonical"]').attr('href', newLocation);