Rank 2: Process
I have a script-min.js file in my Next.js app,, which does some data fetching from appwrite and renders some element with that. That script is hosted on: somthing.vercel.app/script-min.js
Here is the fetch function in that:
const t = await fetch( `https://cloud.appwrite.io/v1/databases/*****/collections/*****/documents?queries[0]=equal("user_id", ["${this.userCode}"])&queries[1]=equal("is_active", [true])`, { method: "GET", headers: { "X-Appwrite-Project": "*******", "Content-Type": "application/json", }, } );For my use case, I want to add two script that will allow rendering some dom element in any website from any origin. If my add the following script in a app which is running on my localhost:**** it works perfectly,
<script src="https://something.vercel.app/script-min.js"></script> <script> Popwola.init("***********"); </script>(note: script-min.js have Popwola class)
but it doesn't work if I add that script in a html file and double click to open it, it doesn't fetch and logs the error in the screenshot.
What can I do if I want to allow access from any origin?
