Tôi đã thử fetchURL của một trang web cũ và đã xảy ra lỗi:
Fetch API cannot load http://xyz.
No 'Access-Control-Allow-Origin' header is present on the requested resource.
Origin 'http://abc' is therefore not allowed access.
If an opaque response serves your needs, set the request's mode to 'no-cors'
to fetch the resource with CORS disabled.
Tôi hiểu thông điệp và cố gắng thực hiện một yêu cầu trả về phản hồi mờ:
fetch("http://xyz", {'mode': 'no-cors'})
Ok, bây giờ nó hoạt động ... nhưng tôi không thể đọc nó. = \
Mục đích sau đó của một phản ứng mờ đục là gì?
Status codeluôn luôn là0, làm thế nào để kiểm tra nếu nó đã thành công nếustatus is never 200?