You can then use as a way to tell your code to stop any logic that may be particularly intensive or battery draining. Note that the document.visibilityState property is only for the top-level window, and the document.visibilityState property of the embedded