javascript - Cross Origin error with window.fetch() on Safari -
i'm trying use window.fetch api , along polyfill unsupporting browsers.
my code works in both chrome , firefox, failing in safari (all on mac osx).
function signup(fullname, email, restaurant, source) { return new promise((resolve, reject) => { const params = `cm-name=${encodeuricomponent(fullname)}&cm-ottdth-ottdth=${encodeuricomponent(email)}&cm-f-hykuuh=${encodeuricomponent(restaurant)}&cm-f-hyurjd=${encodeuricomponent(source)}`; fetch(`http://tastyplc.createsend.com/t/d/s/ottdth/?${params}`, { method: 'get', mode: 'no-cors' }) .then(response => response.text()) .then(data => resolve(data)) .catch(error => reject(error(error))); }); }
i following error in safari:
xmlhttprequest cannot load http://tastyplc.createsend.com/t/d/s/ottdth/?cm-name=example&cm-ottdth-ottdth=example%40example.com&cm-f-hykuuh=charlotte%20street&cm-f-hyurjd=website%20sign%20up. origin http://localhost:3000 not allowed access-control-allow-origin.
could related polyfill being used - since mentions xmlhttprequest (which i'm assuming polyfill falls-back to).
https://github.com/github/fetch
anything i'm doing wrong or missing? it's driving me nuts.
thanks!
Comments
Post a Comment