Share feedback, ideas and get community help

Updated 7 months ago

JavaScript not loading on client

I have the following JS in a Create Variable block that was working fine to parse the URL of the browser but it seems to have stopped working. It was working fine before. The variable "location" is not populating with anything. There are no console errors:

Create Variable block sets first result as currentURL:

Code:
-------
function parseURL() {
const windowURL = window.location.href;
const allSegments = windowURL.split('/');
const relevantSegments = allSegments.slice(4); // slice starts after third '/'
const modifiedSegments = relevantSegments.map(function(segment) {
return segment.replace(/-/g, ' ');
});
return modifiedSegments;
}

//const splitURL = parseURL();
//const currentURL = JSON.stringify(splitURL);
const currentURL = parseURL();

return currentURL;
-------

Then, in a second Create Variable block ("location"), I have:

{{={{currentURL}}[1]=}}

Any ideas why it would have stopped working?
Attachment
image.png
R
B
6 comments
Yes, I know two 'const' lines are commented out. That was from earlier experiments.
I don’t think it’s capable of returning anything into the typebot flow.
I do something similar you can put it in the script on the webpage it’s starting from, and pass it through prefilled variables
It worked perfectly until the latest update.
I managed to reproduce.
Add a reply
Sign up and join the conversation on Discord