是.检查一下.
检查响应是否来自重定向的请求就像在Response对象上检查此标志一样简单.
if (response.redirected) {
//...
}
Run Code Online (Sandbox Code Playgroud)
你可以禁用它:
fetch("awesome-picture.jpg", { redirect: "error" }).then(function(response) {
//some stuff
}).then(function(imageBlob) {
//some other stuff
});
Run Code Online (Sandbox Code Playgroud)