4 ms·
Just tried and I get CORS errors when trying to access localhost in Firefox, also on images via xmlHttp ... Edit: It works with image elements! img = docu
by z3t4 7y ago
Just tried and I get CORS errors when trying to access localhost in Firefox, also on images via xmlHttp ...
Edit: It works with image elements!
img = document.createElement("img")
img.src = "http://localhost:1337/service"
Btw, CORS is a PITA when doing pure web apps, apps that doesn't requre a server. I recently made a RSS reader web app, but had to use a CORS proxy.
I wonder if there is any way I can use an image element to bypass CORS and read RSS xml that way !?
- duncans 7y agoA little shortcut for this is: new Image(1,1).src = 'http://localhost:1337/service'
- heavenlyblue 7y ago>> I wonder if there is any way I can use an image element to bypass CORS and read RSS xml that way !? The article in question says they used the image dimensions to encode the error codes returned by the server when making a request. I can imagine you could simply encode the payload in the dimensions of the image.
- z3t4 7y agoI was thinking about using img.src to replace xmlReq and Fetch. So that I can fetch sites that I do not own. eg. RSS feeds.
- heavenlyblue 7y agoSo how would you receive the data, then?