For those utilizing PHP, consider the following approach:
<?php
session_start();
function storeMessage() {
$_SESSION['message_registered'] = 'Your message...';
}
function getRegisterMessage() {
return $_SESSION['message_registered'];
}
?>
Alternatively, in a javascript-only scenario:
function setMessage(name, msg) {
localStorage.setItem('message_' + name, msg);
}
function getMessage(name) {
return localStorage.getItem('message_' + name, msg);
}
// upon successful submission of the registration form
setMessage('registered', 'Thank you for creating an account!');
// to retrieve the stored message on the desired page
var msg = getMessage('registered');
alert(msg);
Another option involves generating a token in javascript. Each time a tab is opened with your site, a unique token can be created using javascript. This ensures that only the correct tab with the corresponding token receives the designated message, as the token resides in the 'javascript memory' of each tab/window.