So I have this strange issue:
I have a CORS problem when I try to fetch PNG images through Javascript to generate a PDF file.
BUT this problem only occurs if my browser debugger is not displayed. If I Ctrl+Alt+I before loading my page, the problem is not encountered.
This is what I get when I don't open the debugger:
This is what I get when I open the debugger before loading the page:
The pdf I am generating correctly queries the PNGS.
For some reason, opening the browser debugger before sending my fetch request seems to fix a CORS issue.
I checked my front side and we insert CORS for all requests related to the URI I hit. This is just mind boggling.
Could it be the debugger impacting code timings? Or adding a "let cors go"?
This is the fecth code I use:
fetch(data.src, {
"mode": "cors",
"method": "GET",
"headers": [
["Accept", "image/*"]
],
"credentials": "include"
})
.then(function (response) {
return response.arrayBuffer();
})
.then(function (buffer) {
question from:
https://stackoverflow.com/questions/66049576/opening-the-browser-debugger-fixes-my-cors-issue 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…