Skip to content

Commit c9ca0f9

Browse files
committed
Disable prefetcher for Chromium
1 parent f5e81e2 commit c9ca0f9

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/scripts/app/views/articleList.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,12 @@ define([
8989
app.actions.execute('articles:oneFullArticle');
9090
},
9191

92-
handleMouseDown(event){
92+
handleMouseDown(event) {
9393
if (event.button === 1) {
9494
const linkElement = event.target.closest('a');
95-
this.prefetcher.href = linkElement.href;
95+
if (typeof browser !== 'undefined') {
96+
this.prefetcher.href = linkElement.href;
97+
}
9698
}
9799
},
98100

@@ -132,11 +134,13 @@ define([
132134
* @method initialize
133135
*/
134136
initialize: function () {
135-
this.prefetcher = document.createElement('link');
136-
this.prefetcher.rel = 'preload';
137-
this.prefetcher.setAttribute('as', 'fetch');
138-
this.prefetcher.setAttribute('crossorigin', 'crossorigin');
139-
document.head.appendChild(this.prefetcher);
137+
if (typeof browser !== 'undefined') {
138+
this.prefetcher = document.createElement('link');
139+
this.prefetcher.rel = 'preload';
140+
this.prefetcher.setAttribute('as', 'fetch');
141+
this.prefetcher.setAttribute('crossorigin', 'crossorigin');
142+
document.head.appendChild(this.prefetcher);
143+
}
140144

141145

142146
bg.items.on('reset', this.addItems, this);

0 commit comments

Comments
 (0)