Is not better to use visibilitychange instead mozvisibilitychange?
https://developer.mozilla.org/en-US/docs/DOM/Using_the_Page_Visibility_API