Skip to content

Commit b31b2a1

Browse files
committed
fix: don't prefetch if Save-Data is enabled
1 parent ee94643 commit b31b2a1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@ export default (Vue, { componentName = 'RouterLink' } = {}) => {
2929
}
3030
},
3131
mounted() {
32+
const conn = navigator.connection
3233
const canPrefetch =
33-
!navigator.connection ||
34-
navigator.connection.effectiveType.indexOf('2g') === -1
34+
!conn ||
35+
((conn.effectiveType || '').indexOf('2g') === -1 && !conn.saveData)
3536
if (this.prefetch && observer && canPrefetch) {
3637
setTimeout(() => {
3738
this.observe()

0 commit comments

Comments
 (0)