从浏览历史记录中删除敏感的URL数据

问题描述 投票:0回答:2

我有这样的网址:

https://localhost:8081/test.php#param1=test&param2=sensitivedata

“ param2”参数有些敏感,所以我不想在浏览器的历史记录中使用它。

我正在使用以下代码:

window.location.replace("#");

这样可以有效地从Chrome中的用户历史记录中删除数据,但数据仍保留在Firefox中。有没有办法在Firefox中做到这一点?

我已经尝试过

history.replaceState(null, null, ' ');

但是在Chrome或Firefox上不起作用,数据仍保留在用户历史记录中。

提前感谢

javascript google-chrome firefox browser-history
2个回答
0
投票

嗯,经过一些研究,似乎无法做我需要的事情。据此bug report

对于Firefox:history.replaceState创建新的历史记录项

Chrome 28:location.replace和history.replaceState均创建新全局历史记录UI中的条目。 Chrome 30:location.replace更新现有条目history.replaceState创建新条目Opera 12:location.replace和history.replaceState都不会创建新条目(但都不会更新现有条目)Opera 15:有时location.replace创建新条目,有时会更新现有条目一个(不知道标准是什么)。 history.replaceState总是创建一个新条目。 Safari 6:location.replace和history.replaceState在全局历史记录UI中创建新条目。

因此,似乎没有可靠的方法可以从用户的历史记录中删除数据。


0
投票

嗯,也许可以一起尝试这些解决方案:

© www.soinside.com 2019 - 2024. All rights reserved.