如何使用导航请求模式?

How to use the navigate request mode?

It is said that this request mode is a special mode。它太特别了,我找不到使用它的例子,下面的代码在控制台中引发错误。

fetch("http://ytrezq.sdfeu.org/flashredirect/?https://github.com/git-receive-pack", {mode:"navigate"})
  .then(function(response) {console.log(response);});;

虽然 mode 选项采用来自 Request.mode 接口的值,但并非所有可能的 Request.mode 值都允许获取。

来自MDN

navigate — A mode for supporting navigation. The navigate value is intended to be used only by HTML navigation. A navigate request is created only while navigating between documents.

因此,要使用它,请单击 HTML 文档中的常规 link 或将新的 URL 分配给 location 全局。浏览器会在后台将模式设置为 navigate