Streaming live at 10am (PST)

Dynamic script tag in custom code block

Hello there!
Is there any way to conditionally change ‘src’ attribute in script tag in project custom code, based on domain?

For example, I have two script links:
https://somedomain.com/projects/myproject/beta/app.js
https://somedomain.com/projects/myproject/production/app.js

The former is for testing purposes, the latter is for production build only.
I could’ve made some script which would dynamically create the script tag, but the test script link will still be observable via devtools, and that’s unacceptable due to security reasons.

Looking forward to get some viable solutions, thanks in advance!

1 Like

it would be very nice if there was an opportunity to parameterize custom code or add any template engine
Example:

<script src="https://somedomain.com/{{WEBFLOW_DOMAIN.includes('beta.mydomain.com') ? 'beta' : 'production'}}/app.js"></script>

Webflow can handle it when compiling the templates and publish them to the user domain.