non-https clipboard newlines; fixes #161

This commit is contained in:
ed 2025-04-28 19:00:13 +00:00
parent 4fb87ebe32
commit 94352f278b

View file

@ -1229,7 +1229,7 @@ function dl_file(url) {
function cliptxt(txt, ok) {
var fb = function () {
console.log('clip-fb');
var o = mknod('input');
var o = mknod('textarea');
o.value = txt;
document.body.appendChild(o);
o.focus();
@ -1239,6 +1239,8 @@ function cliptxt(txt, ok) {
ok();
};
try {
if (!window.isSecureContext)
throw 1;
navigator.clipboard.writeText(txt).then(ok, fb);
}
catch (ex) { fb(); }