瀏覽代碼

Fix HTTP links not being preloaded

The first part of the condition returned true in that case, making the overall condition true.
Alexandre Dieulot 6 年之前
父節點
當前提交
454f9b5558
共有 1 個文件被更改,包括 5 次插入1 次删除
  1. 5 1
      instantpage.js

+ 5 - 1
instantpage.js

@@ -99,7 +99,11 @@ function isPreloadable(linkElement) {
     return
   }
 
-  if (urlObject.protocol != 'https:' || (urlObject.protocol == 'http:' && location.protocol == 'https:')) {
+  if (!['http:', 'https:'].includes(urlObject.protocol)) {
+    return
+  }
+
+  if (urlObject.protocol == 'http:' && location.protocol == 'https:') {
     return
   }