Javascript - Detect if script has already loaded or not

Hi, On page load, I am running a workflow that loads stripe.js.

I see the web console is warning me “[Stripe.js] It looks like Stripe.js was loaded more than one time. Please only load it once per page.”.

Is there a simple way in weweb (assuming in the javascript) to detect if this is not already loaded for the page and skip over that function?

Thanks

You could use an if clause to see if the stripe object is initialized, e.g. if(!stripe) { //… your script here }. Also I’d suggest using “On app load” instead of the “On page load” since that of course will fire each time you change a page. Loading this on app load will make it load only once when your app loads for the first time.