From fdeeffb5674a9a13c335579e1551008c591d20e7 Mon Sep 17 00:00:00 2001 From: SinTan1729 Date: Thu, 7 Nov 2024 19:33:34 -0600 Subject: [PATCH] fix: Disable copying to clipboard on WebKit, fixes #36 This disables clipboard copying and lets the user manually copy the links. --- resources/static/script.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/resources/static/script.js b/resources/static/script.js index 19534fd..de796da 100644 --- a/resources/static/script.js +++ b/resources/static/script.js @@ -109,7 +109,10 @@ const TR = (row, site) => { const tr = document.createElement("tr"); const longTD = TD(A_LONG(row["longlink"]), "Long URL"); var shortTD = null; - if (window.isSecureContext) { + var isSafari = /Safari/.test(navigator.userAgent) && /Apple Computer/.test(navigator.vendor); + // For now, we disable copying on WebKit due to a possible bug. Manual copying is enabled instead. + // Take a look at https://github.com/SinTan1729/chhoto-url/issues/36 + if (window.isSecureContext && !(isSafari)) { shortTD = TD(A_SHORT(row["shortlink"], site), "Short URL"); } else { shortTD = TD(A_SHORT_INSECURE(row["shortlink"], site), "Short URL");