Help with XMLHttpRequest

700 views
Skip to first unread message

Sharanya Braja Patnaik

unread,
Mar 9, 2022, 7:40:47 AM3/9/22
to Google Apps Script Community
Hi,

I am trying to POST some data from one web page to a another web page using  a simple XMLHttpRequest. But, I am getting the below error in the browser console:

Access to XMLHttpRequest at 'https://script.google.com/macros/.../exec?page=xhrPOST' from origin 'https://n-vyagdopnmsgy6gudvqtfoymdagns4u7h2hhal4q-0lu-script.googleusercontent.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

In some forums, I saw that one can change the CORS settings in the server if one uses google cloud. But I am using a free google account, so unable to change any settings on server side.

Is there anyway to overcome this?


Regards
Braja

Jonathan Butler

unread,
Mar 9, 2022, 9:51:48 PM3/9/22
to google-apps-sc...@googlegroups.com
Are you attempting to send a message from one Google apps script webpage to another google apps script webpage? If so, you can cache the data and long poll the cache.

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/e008cf10-e1eb-4f88-bead-d98a521bf65bn%40googlegroups.com.

Sharanya Braja Patnaik

unread,
Mar 10, 2022, 1:00:40 AM3/10/22
to Google Apps Script Community
Yes, I am posting data from one  Google apps script webpage to another google apps script webpage.
Thank you for your suggestion. Will try out the cache solution!
Regards..Braja
Reply all
Reply to author
Forward
0 new messages