The visibilitychange listener did not go off for me using firefox 115.14.0esr (64-bit). So it doesn't seem to work for refresh detection.