If I'm not mistaken, the browser will run until the script is finished either by timeout, by memory exhaustion, or any other method that would kill the script on the server. I have some data processing scripts that run for 30 minutes or so. There nothing that I know of that would cause the browser state to freeze thinking the script is still loading after it has timed out on the server.
If you still want to monitor the script, the only way that I know of doing this would be to execute the script in the background, and check to see if the process is still running every few seconds. Since php isn't asynchronous like Java, it takes some hacking to get a function like this to work.
You would want to execute the script in the background:
exec('/path/to/php -f /path/to/script.php > /dev/null 2>&1 & echo $!',$op);
$pid = (int)$op[0];
Then, you can use a function like this to check if a process is still running.
function isRunning($pid) {
exec("ps $pid", $ProcessState);
return(count($ProcessState) >= 2);
}
Then you would use
while(isRunning($pid)) {
echo 'Still running...';
sleep(10);
//or something like this
}