Skip to content

Commit 17a2f07

Browse files
committed
feat: auto open if it is a URL
1 parent d7aa213 commit 17a2f07

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

app/components/Scan.vue

+5
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,11 @@ async function scanFrame(result: QrScanner.ScanResult) {
296296
297297
if (contentType.value.startsWith('text/')) {
298298
textContent.value = new TextDecoder().decode(mergedData)
299+
300+
// auto open if it's a URL
301+
if (/^https?:\/\//.test(textContent.value)) {
302+
window.open(textContent.value, '_blank')
303+
}
299304
}
300305
}
301306
// console.log({ data })

0 commit comments

Comments
 (0)