Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It is a security measure. Suppose you have a marketing site for a client. You'd like users to be able to fill out and submit a contact form. A host like neocities can display the html with the form to users, but neocites won't let you POST the form and do anything with the data. So, CORS allows your page on neocities to POST data to another domain (ie www.othersite.com). The javascript on the page would do something "event.prefentDefault()" to keep the user on the page, doing the form submission via ajax. Then the server at www.othersite.com can do stuff with the data.

There are third party services that provide form processing of this nature, and even complete database backends and user management APIs (I built one).



Thanks! Studying CORS now.




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

Search: