We're a place where coders share, stay up-to-date and grow their careers.
You could also use the browser Clipboard API - "navigator.clipboard"
const str = 'String to copy' function copyToClipboard (str) { navigator.clipboard.writeText(str) }
Yeah it's a great one. But it's still not supported by all browsers.
That's the only one to use to be honest, and according to caniuse, all browsers support it except Opera Mini and UC Browser for Android.
You could also use the browser Clipboard API - "navigator.clipboard"
Yeah it's a great one. But it's still not supported by all browsers.
That's the only one to use to be honest, and according to caniuse, all browsers support it except Opera Mini and UC Browser for Android.