PerfilUsuario.jsx
Код: Выделить всё
if (user) {
const url = `${window.location.origin}/perfil/${user.uid}/compartir`;
navigator.clipboard.writeText(url);
alert("¡Enlace copiado! Comparte este enlace: " + url);
// Intenta copiar con navigator.clipboard.writeText()
navigator.clipboard
.writeText(url)
.then(() => {
alert("¡Enlace copiado! Comparte este enlace: " + url);
})
.catch(() => {
// Método de respaldo usando document.execCommand()
const textArea = document.createElement("textarea");
textArea.value = url;
document.body.appendChild(textArea);
textArea.select();
document.execCommand("copy");
document.body.removeChild(textArea);
alert("¡Enlace copiado! Comparte este enlace: " + url);
});
}
https://github.com/clemesilva/Ameterle2.git
Подробнее здесь: https://stackoverflow.com/questions/791 ... -404-error