diff --git a/extensions/remote-control/html.ts b/extensions/remote-control/html.ts
index 7c77d09..7abd0bd 100644
--- a/extensions/remote-control/html.ts
+++ b/extensions/remote-control/html.ts
@@ -717,6 +717,15 @@ export function buildHTML(nonce: string): string {
});
connect();
+
+ document.addEventListener('visibilitychange', function () {
+ if (document.visibilityState === 'visible') {
+ if (!ws || ws.readyState !== 1) {
+ clearTimeout(timer);
+ connect();
+ }
+ }
+ });
})();