Improve RustDesk connect button fallback
This commit is contained in:
parent
f7ad7f6a17
commit
040a9e4569
1 changed files with 11 additions and 1 deletions
|
|
@ -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.")
|
||||
}
|
||||
}, [])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue