Alternatively, if this is a simple string, you can add the URL of the page while navigating to another page. If this is protected data, you can encrypt the string and attach.
Your URL will look like this: example.com/nextPage?x=booked
On the next page, you can get the string by decrypting it as indicated:
var encodedData = window.location.href.split('=')[1]; var bookedValue = decodeURI(encodedData);
If you have encrypted the script, you need to decrypt on the next page.
source share