You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use fetch in javascript to request data from https://ssl-checker.io/api/v1/check/. Code below. However the browsers CORS policy blocks it and says "No 'Access-Control-Allow-Origin' header is present on the requested resource."
The browser offers opaque response with the option {mode: 'no-cors'}. This lets throught the request, but the result is no data.
I use fetch in javascript to request data from https://ssl-checker.io/api/v1/check/. Code below. However the browsers CORS policy blocks it and says "No 'Access-Control-Allow-Origin' header is present on the requested resource."
The browser offers opaque response with the option {mode: 'no-cors'}. This lets throught the request, but the result is no data.
const option = {mode: 'no-cors'}; fetch (url, option).then(res => { if (!res) { console.log('Response not ok!'); return; } console.log(res); return res.text(); }).then(data => console.log('data:', data)).catch(error => console.log(error));
I have also tried
return res.json();
instead ofreturn res.text();
, which results in SyntaxError: Unexpected end of input at 'json()'.Does the API request require anything more than the url (g.e. 'cnn.com')?
/A
The text was updated successfully, but these errors were encountered: