Implement more reliable page load detection functions.