ajax - Unable to send XMLHttpRequest via tampermonkey script with CORS enabled on server -
i have setup flask http server configured accept cors requests (for purpose of creating userscript web filter), unable send http requests via tampermonkey, following code.
// ==userscript== // @name cors test // @namespace john galt // @version 1 // @grant none // ==/userscript== var request = new xmlhttprequest(); request.open("get", "127.0.0.1:5000", false); request.send(); alert("finished");
"finished" not alerted indicating failure of operation, , following error appears in console:
xmlhttprequest cannot load %3127.0.0.1:5000. cross origin requests supported http. rand.html:1 error: execution of script 'cors test' failed! failed execute 'send' on 'xmlhttprequest': failed load '%3127.0.0.1:5000'. error: failed execute 'send' on 'xmlhttprequest': failed load '%3127.0.0.1:5000'. @ error (native) @ object.eval (eval @ <anonymous> (unknown source), <anonymous>:19:9) @ object.eval (eval @ <anonymous> (unknown source), <anonymous>:23:4) @ e (<anonymous>:41:76) @ eval (eval @ <anonymous> (unknown source), <anonymous>:1:24) @ eval (native) @ m (<anonymous>:68:246) @ z (<anonymous>:41:92) @ aa (<anonymous>:78:392) @ b (<anonymous>:79:109)
i have no experience front-end point out if problem server configuration or on front-end, , if so, there workaround?
the first line problem. can use xmlhttprequest on same domain code on, can't fetch other origins.
here 1 alternative solution how fix cross origin error in extjs6?
Comments
Post a Comment