0
0
mirror of https://github.com/honojs/hono.git synced 2024-11-21 18:18:57 +01:00

Revert "fix(helper/adapter): don't check navigator is undefined (#3171)" (#3173)

This reverts commit a285c4b3b4.
This commit is contained in:
Yusuke Wada 2024-07-22 11:35:04 +09:00 committed by GitHub
parent bb14b1e5ba
commit 4d33e1c0d4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -47,12 +47,8 @@ export const getRuntimeKey = (): Runtime => {
const global = globalThis as any
// check if the current runtime supports navigator.userAgent
let userAgentSupported = false
// In Cloudflare Pages, navigator is undefined in the production environment.
// Therefore, it only check navigator.userAgent.
try {
userAgentSupported = typeof navigator.userAgent === 'string'
} catch {}
const userAgentSupported =
typeof navigator !== 'undefined' && typeof navigator.userAgent === 'string'
// if supported, check the user agent
if (userAgentSupported) {