Hacker News new | past | comments | ask | show | jobs | submit login

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 !?






>> 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.


I 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.

So how would you receive the data, then?

A little shortcut for this is:

    new Image(1,1).src = 'http://localhost:1337/service'



Registration is open for Startup School 2019. Classes start July 22nd.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: