From c6d7b64d10719695d107b1a21af9505bf12adfb0 Mon Sep 17 00:00:00 2001 From: Fen Dweller Date: Sun, 21 Mar 2021 17:54:17 -0400 Subject: [PATCH] Add an exception handler for copying to the clipboard --- macrovision.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/macrovision.js b/macrovision.js index a5c51dfe..af65d81c 100644 --- a/macrovision.js +++ b/macrovision.js @@ -3756,8 +3756,13 @@ function linkScene() { loc = new URL(window.location); const link = loc.protocol + "//" + loc.host + loc.pathname + "?scene=" + b64EncodeUnicode(JSON.stringify(exportScene())); window.history.replaceState(null, "Macrovision", link); - navigator.clipboard.writeText(link); - toast("Copied permalink to clipboard"); + try { + navigator.clipboard.writeText(link); + toast("Copied permalink to clipboard"); + } catch { + toast("Couldn't copy permalink"); + } + } function copyScene() {