There are two methods that come to my mind. The first in the category 'push-messages'. Not a lot of experience with that, so im going to continue to option 2:
Add a last-edit timestamp in the same table/row as text
is. When someone updates the text, update the timestamp.
When an user loads a page, also send the last-edit timestamp in a javascript variable. Then make a super-lightweight AJAXcall to a verify-file, along the lines of this:
$query = "SELECT text,last_edit FROM someTable WHERE lastedit>".$_GET['timestampFromJS']." LIMIT 1";
$result = mysqli_query($conn, $query);
if( $result->num_rows===0 ){
echo 0; // something small for JS
}
else{
$fetch = $result->fetch_assoc();
echo $fetch['text'];
}
In the success handler of your javascript code, check if the value is not equal to 0
, if it's not 0
, use the result to update the page.
There might be other solutions, or you might prefer JSON (I know I do :P), but you'll get the draft of the idea :)