Use google function to register onpagehide event, keeps it in tact during compilation.