Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions instantpage.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const prefetches = new Set()
const prefetchElement = document.createElement('link')
const isSupported = prefetchElement.relList && prefetchElement.relList.supports && prefetchElement.relList.supports('prefetch')
&& window.IntersectionObserver && 'isIntersecting' in IntersectionObserverEntry.prototype
const isOnline = () => window.navigator.onLine
const allowQueryString = 'instantAllowQueryString' in document.body.dataset
const allowExternalLinks = 'instantAllowExternalLinks' in document.body.dataset
const useWhitelist = 'instantWhitelist' in document.body.dataset
Expand Down Expand Up @@ -223,6 +224,10 @@ function isPreloadable(linkElement) {
}

function preload(url) {
if (!isOnline()) {
return
}

if (prefetches.has(url)) {
return
}
Expand Down