未验证 提交 69a34dd7 编写于 作者: J Joe Haddad 提交者: GitHub

Fix IE11 Prefetching (#9823)

上级 3e05139d
import mitt from '../next-server/lib/mitt' import mitt from '../next-server/lib/mitt'
function hasPrefetch(link) { function hasRel(rel, link) {
try { try {
link = document.createElement('link') link = document.createElement('link')
return link.relList.supports('prefetch') return link.relList.supports(rel)
} catch {} } catch {}
} }
const relPrefetch = hasPrefetch() const relPrefetch =
? // https://caniuse.com/#feat=link-rel-prefetch hasRel('preload') && !hasRel('prefetch')
// IE 11, Edge 12+, nearly all evergreen ? // https://caniuse.com/#feat=link-rel-preload
'prefetch'
: // https://caniuse.com/#feat=link-rel-preload
// macOS and iOS (Safari does not support prefetch) // macOS and iOS (Safari does not support prefetch)
'preload' 'preload'
: // https://caniuse.com/#feat=link-rel-prefetch
// IE 11, Edge 12+, nearly all evergreen
'prefetch'
const hasNoModule = 'noModule' in document.createElement('script') const hasNoModule = 'noModule' in document.createElement('script')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册