javascript - 如何制作不会添加到浏览器历史记录的链接
问题描述
我想创建一个秘密 URL,它将对用户进行身份验证以执行某些操作,但它不会出现在浏览器历史记录中。
例如,我认为这样的事情会起作用
- 特殊链接,例如
https://example.org/page#specialHashGivesAccess
通过电子邮件发送给合适的人。为此目的,电子邮件被认为足够安全。 - 页面上运行的 Javascript 通过 ajax 将秘密发送到服务器,该服务器对其进行检查并返回一个临时哈希值。
- Javascript
window.location.replace
使用临时哈希对页面进行处理。 - 该应用程序然后检查临时哈希,如果 OK 则显示内容。
- 临时哈希会在短时间内过期,也可以手动过期。
- 原始特殊链接 (1) 不在浏览器历史记录中。
此外,执行此工作的脚本;应用程序脚本和 ajax 服务器是远程的。即生成example.org/page
has<script src="https://siteb.com/app.js">
和ajax 的siteA 是使用CORS 完成的。
但是,在我的测试中它似乎并不可靠,我specialHashGivesAccess
在我的历史中发现。
有没有办法做到这一点?
解决方案
It can't be done (at the time of posting this answer).
While there are many methods for manipulating the session history, it is not possible to prevent an entry being created in the global history, or to overwrite the first page load request stored there.
Therefore the solution I'm going to go with is along the lines of
Hi,
To access the service you can use the following link and password:
- https://example.org/myApp
- password: aabbccddeeff00112233
If nobody else uses your browser you can use the following shortcut link to save you entering the password, however note that this will give access to the service to anyone that has access to your browsing history.
推荐阅读
- jmeter - jmeter(5.0) 负载测试和报告生成
- node.js - 如何在服务器中下载文件
- git - 从 gcp 克隆代码时如何解决此错误?
- r - 通过比较两列来改变新的布尔列
- sql - 授予用户 ' 的权限不足以执行此操作
- php - PHP在数组json中提取键值并重组
- java - Java 中的新特性 Lambda 重载
- ruby - 权限被拒绝 - /dev/ttyS6 (Errno::EACCES)
- flutter - Flutter 在片段内加载 webview
- nhibernate - 尝试使用时出错
在 NHibernate Profiler 中使用 NProfAppender