-
Notifications
You must be signed in to change notification settings - Fork 211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug:Docs] Copy button broken in Firefox #818
Comments
Can confirm happens on Firefox in PopOS (Ubuntu Derivative) as well.
|
I confirm that error on Firefox at Mac (123.01), Windows 11, Linux :c |
I just did this for something else. I believe this function should work in Firefox: function copyUrlToClipboard(text) {
if (navigator.clipboard && window.isSecureContext) {
navigator.clipboard.writeText(text).then(() => {
console.log('URL copied to clipboard.');
}).catch((err) => {
console.error('Failed to copy the URL: ', err);
});
return;
}
const textArea = document.createElement('textarea');
textArea.value = text;
textArea.style.position = 'fixed'; // avoid scrolling to bottom
textArea.style.opacity = '0'; // hidden
document.body.appendChild(textArea);
textArea.focus();
textArea.select();
try {
document.execCommand('copy');
console.log('URL copied to clipboard.');
} catch (err) {
console.error('Failed to copy the URL: ', err);
}
document.body.removeChild(textArea);
}
copyUrlToClipboard(text); It's used here: https://x5c.bnna.net/ Update: |
What were you trying to install (or what else went wrong)?
trying to copy the install code for a library
What exactly did you do?
hit the copy button on the zig install on this page: https://webinstall.dev/zig/
What went wrong?
nothing happened, copy failed, console produced this error:
Which OS did you try on?
macOS 14.3.1, Firefox 123.0
What type of computer (i.e. laptop, desktop, Raspberry Pi)?
The text was updated successfully, but these errors were encountered: