Skip to content

Commit

Permalink
🥅 handle error when sharing is aborted
Browse files Browse the repository at this point in the history
  • Loading branch information
krmax44 committed Oct 28, 2024
1 parent 6e32fcd commit c3b4ca8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion frontend/javascript/snippets/share-links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,13 @@ document.querySelectorAll<HTMLElement>('.share-native').forEach((btn) => {
btn.hidden = false

btn.addEventListener('click', () => {
navigator.share(shareObj)
try {
navigator.share(shareObj)
} catch (e) {
if (!(e instanceof DOMException)) {
throw e
}
}
})
}
}
Expand Down

0 comments on commit c3b4ca8

Please sign in to comment.