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

Fix IE11 Prefetching (#9823)

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