Index: include.preload.js |
=================================================================== |
--- a/include.preload.js |
+++ b/include.preload.js |
@@ -580,17 +580,36 @@ |
}; |
if (document instanceof HTMLDocument) |
{ |
checkSitekey(); |
wrapWebSocket(); |
var elemhide = new ElemHide(); |
- elemhide.apply(); |
+ |
+ if (document.visibilityState == "prerender") |
+ { |
+ // For prerendered documents, wait until the document is made visible. We |
+ // do not have access to the page property of the SafariBrowserTab object |
+ // associated with this document until it is visible. Without the page |
+ // property, we cannot get a response from the background page. |
+ let onVisibilitychange = function() |
+ { |
+ document.removeEventListener("visibilitychange", onVisibilitychange); |
+ |
+ elemhide.apply(); |
+ }; |
+ |
+ document.addEventListener("visibilitychange", onVisibilitychange); |
+ } |
+ else |
+ { |
+ elemhide.apply(); |
+ } |
document.addEventListener("error", function(event) |
{ |
checkCollapse(event.target); |
}, true); |
document.addEventListener("load", function(event) |
{ |