Skip to content

Commit

Permalink
feat: auto open if it is a URL
Browse files Browse the repository at this point in the history
  • Loading branch information
LittleSound committed Oct 12, 2024
1 parent d7aa213 commit 17a2f07
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/components/Scan.vue
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,11 @@ async function scanFrame(result: QrScanner.ScanResult) {
if (contentType.value.startsWith('text/')) {
textContent.value = new TextDecoder().decode(mergedData)
// auto open if it's a URL
if (/^https?:\/\//.test(textContent.value)) {
window.open(textContent.value, '_blank')
}
}
}
// console.log({ data })
Expand Down

0 comments on commit 17a2f07

Please sign in to comment.