The polyfill is linked in my post. It’s production ready and should be used to future proof all code, not to mention build the right skills and habits in new developers.
Ah ok, yes I see it now, but at the bottom of linked page is small note, that this polyfill won’t affect modern browsers as they contain native implementations of window.fetch. Also you need to write your own error handler to catch standard HTTP errors. Really it’s better to use jquery ajax.
Please, show me how navigator.geolocation works in HTTP on Chrome 50 and up
This is, indeed, how polyfills work It only fills in missing functionality if it’s missing. Using jQuery is certainly an option, but maybe a bit heavyweight for just AJAX. Something like axios is great if you just want a promise based HTTP request library. Since a person needs to write their own error handlers for xhr objects as well, this doesn’t really affect the choice for fetch, but you’re definitely right to choose a more complete library.
It doesn’t, and it shouldn’t. But trying to forego HTTPS is the worst way to handle the incompatibility. Use a different API, like jenovs suggested, or a CORS proxy, like cors-anywhere. By relying on an insecure connection, you cripple your application and force your users to choose between your app and their security
Sorry, but I really don’t see a point using this polyfill I just wrote xhr function which works, that’s all.
jenovs suggested API which is not free, it’s free up to 1000 calls a day, which give us about 41 calls per h and after that you’re charged. I am also not happy using http but in this case I had to.