如何使用导航请求模式?

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

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);});;
javascript fetch-api
1个回答
0
投票

虽然mode选项采用来自Request.mode接口的值,但并不是所有可能的Request.mode值都可以用于获取。

来自MDN

导航 - 支持导航的模式。导航值仅供HTML导航使用。仅在文档之间导航时创建导航请求。

因此,要使用它,请单击HTML文档中的常规链接或为location全局分配新URL。浏览器将模式设置为引擎盖下的navigate

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