Improve RustDesk connect button fallback

This commit is contained in:
Esdras Renan 2025-11-27 08:14:18 -03:00
parent f7ad7f6a17
commit 040a9e4569

View file

@ -3330,10 +3330,20 @@ export function DeviceDetails({ device }: DeviceDetailsProps) {
return
}
try {
window.location.href = link
// Alguns navegadores bloqueiam location.href para protocolos custom; use anchor + click como fallback.
const anchor = document.createElement("a")
anchor.href = link
anchor.rel = "noreferrer"
anchor.target = "_self"
document.body.appendChild(anchor)
anchor.click()
document.body.removeChild(anchor)
toast.success("Abrindo o RustDesk...")
} catch (error) {
console.error(error)
try {
window.open(link, "_blank", "noreferrer")
} catch {}
toast.error("Não foi possível acionar o RustDesk neste dispositivo.")
}
}, [])