JavaScript can pass variable to text but not save it

Hey guys!

In our project, our service can be embedded as iFrame and we need to read out the URL of the site the service is embedded in.
The js we are using to accomplish this, is
var currentUrl = document.referrer; return currentUrl;
And the code works.

If I bind the script to a text, the current URL is displayed.

The problem is, we need the URL as a variable. And as you can see in the screenshot, even though the URL is displayed as text, it apparently has no value. And if we save it in a variable, it has no value as well.

What could we do?

Thank you in advance
Aaron

That’s probably because the variable and the result of the formula are evaluated in the editor, but your binding in the text is evaluated in the app iframe. The app iframe has a referer as it embeded inside the editor, but the editor has no referer. So it should probably works if you publish and embed your website :+1:

Great, thanks Alexis!

Right now, it works.

Best regards
Aaron

1 Like