This event is emitted before a link is preloaded.
Listeners may prevent this event to stop the link from being preloaded, or change render options for the preload request.
The following would disable preloading on slow 2G connections:
function isSlowConnection() {
// https://developer.mozilla.org/en-US/docs/Web/API/NetworkInformation
return navigator.connection && navigator.connection.effectiveType.include('2g')
}
up.on('up:link:preload', function(event) {
if (isSlowConnection()) {
event.preventDefault()
}
})
The link element that will be preloaded.
An object with render options for the preloading.
Listeners may inspect or modify these options.
Prevents the link from being preloaded.