Use AJAX.
Inside B page create a request function to check the status of MySQL flag. If the flag is set to true
, refresh the page.
In HTML of B program insert:
<head>
...
<script>
function enableChecker() {
setInterval( checkFlag, 10000); // Check each ten seconds
}
function checkFlag() {
xmlhttp = GetXmlHttpObject();
if ( xmlhttp==null ) return;
xmlhttp.onreadystatechange = function() {
if ( xmlhttp.readyState == 4 ) {
if ( xmlhttp.responseText == "OK" ) {
location.reload(); // Refresh the page
}
}
}
xmlhttp.open( 'GET', 'myCheckProgram.php', true ); // Call php program to check the flag value
xmlhttp.send( null );
return false;
}
</script>
</head>
<body onload="enableChecker()" >
Create a program called myCheckProgram.php
<?php
/* Blah blah to connect with database and query for flag */
$flag = // Result of query
echo $flag ? 'OK' : 'NOK' // Return OK if flag is true
?>