From 8d2fe315dbdd7d02626736b693a03ed75aab965a Mon Sep 17 00:00:00 2001 From: Woody <27882680+WoodyLetsCode@users.noreply.github.com> Date: Thu, 24 Mar 2022 12:17:10 +0100 Subject: [PATCH] Fix cross-origin error in File Mode (#2585) * fixed cross-origin error * removed unnecessary code * try/catch for parent WS Co-authored-by: cschwinne --- wled00/data/liveviewws.htm | 5 ++++- wled00/html_other.h | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/wled00/data/liveviewws.htm b/wled00/data/liveviewws.htm index 9234d317..5c44c4de 100644 --- a/wled00/data/liveviewws.htm +++ b/wled00/data/liveviewws.htm @@ -45,7 +45,10 @@ } } - var ws = top.window.ws; + var ws; + try { + ws = top.window.ws; + } catch (e) {} if (ws && ws.readyState === WebSocket.OPEN) { console.info("Peek uses top WS"); ws.send("{'lv':true}"); diff --git a/wled00/html_other.h b/wled00/html_other.h index bdccf6f1..ad5bc628 100644 --- a/wled00/html_other.h +++ b/wled00/html_other.h @@ -85,7 +85,7 @@ charset="utf-8"> WLED Live Preview
)=====";