+ 1
XMLHttpRequest error
What's wrong? Pls help. https://code.sololearn.com/WnmS72GXbwg0/?ref=app
4 Antworten
+ 6
Basically the problem is XHR does not allow cross-origin requests. Here you can read more:
https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
In this case you should try JQuery and make a Jsonp request, or look for an alternative to do that in pure JS (I'm not entirely sure that Jsonp works in this case, mainly because of what you're trying to get).
+ 5
You appear to have these concerns:
1. Change http: to https: for mobile; allow headers /seem/ to be okay then
2. Certificate name mismatch: https://www.ssllabs.com/ssltest/analyze.html?d=www.tesseract.cba.pl
3. var xhttp is recreated instead of reused, which may be interfering with event capture (status codes, e.g.)
4. Error in setInterval() should be intercepted by window.onerror() + clearInterval(savedIntervalHandle)
5. html.outerHTML can't be set; I got innerHTML to work, but...
6. 404 Not Found seems to be coming from the server (only on https /port 443):
Use this to examine comms (or wireshark, tcpdump, firefox/chrome developer mode, etc)
https://code.sololearn.com/choOE8kwZEmk/?ref=app
+ 3
this kind of request only works if the requested file is hosted from the same domain (from which the site is hosted). for security reasons.
+ 3
Been fighting my system [slows me down] but was last playing with your request / response code to see if I could change the output of directly requesting the text file when POSTing; it never changed, regardless of sent data. No apparent status text was returned (you may want to use onerror()...) and also, I was using encodeURIComponent() on the innerHTML as a guess.
This code has working XHR including errors and data transfer starting at [JS] line 131.
https://code.sololearn.com/WEZ5IZ0B4v4S/?ref=app
Have to go recharge; hopefully something helped, good luck.