jsdevel / google-form

Simple AJAX request to POST data to a google form.
MIT License
48 stars 16 forks source link

No 'Access-Control-Allow-Origin' #3

Open jack-fdrv opened 6 years ago

jameswilson commented 4 years ago

The complete error message in JS console is:

Access to XMLHttpRequest at 'https://docs.google.com/forms/d/e/xxxx/formResponse' from origin 'https://test-cors.org' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

It basically seems like this script is no longer possible to work in modern browser due to CORS policies, and the fact that https://docs.google.com/forms doesnt have any CORS setup.

You can test to confirm by pasting any Google Form URL into https://www.test-cors.org/#?client_method=POST, and hitting Submit. Note: you need to open your JS console to see the error message.

This message indicates that responses from https://docs.google.com/forms/d/e/xxxx/formResponse URLs currently don’t include the Access-Control-Allow-Origin response header, so browsers won’t allow any JavaScript code to access the response.