javascript - 如何使用导航请求模式?
问题描述
据说这种请求模式是一种特殊模式。它是如此特别,以至于我找不到使用它的示例,并且下面的代码在控制台中引发了错误。
fetch("http://ytrezq.sdfeu.org/flashredirect/?https://github.com/git-receive-pack", {mode:"navigate"})
.then(function(response) {console.log(response);});;
解决方案
While the mode
option takes a value that is from the Request.mode
interface, not all of the possible Request.mode
values are allowed for fetch.
From 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.
So to use it, click a regular link in an HTML document or assign a new URL to the location
global. The browser will set the mode to navigate under the hood.
推荐阅读
- swift - Firebase 实时数据库定价与查询
- amazon-dynamodb - DynamoDB - 根据条件放置项目
- memory-management - 不可变字符串和克隆
- asp.net-core - 如果自定义参数无效,IdentityServer4 拒绝令牌请求
- c# - 计算 RSI 以优化新元素
- c - 如何使用 fwrite 编写向量(或结构)的一部分
- nlp - 对问答系统 NLP 的建议
- docker - Nginx 无法访问 Docker 卷挂载
- github - 未验证电子邮件时如何重置 GitHub.com 密码?
- laravel - Laravel Passport:试图获取非对象的属性“id”