Mobile app version of vmapp.org
Login or Join
Fox8124981

: Chrome prerender "Non-Empty Browsing Instance" I'm experimenting with Chrome rel="prerender". On one specific site, the page I'm suggesting gets prerendered, but is then loaded again, not switched

@Fox8124981

Posted in: #GoogleChrome #Rel

I'm experimenting with Chrome rel="prerender". On one specific site, the page I'm suggesting gets prerendered, but is then loaded again, not switched when the link is clicked. As reported on chrome://net-internals/#prerender, the reason for failing is listed as Non-Empty Browsing Instance.

I've tried searching for some explanation about this particular problem, but haven't found any. Does anyone have any experience or ideas what causes Non-Empty Browsing Instance, and how to fix it?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Fox8124981

2 Comments

Sorted by latest first Latest Oldest Best

 

@Samaraweera270

Non-Empty Browsing Instance appears if you have 2 windows of Chrome open. Keep a single window open and you will not get this error.

10% popularity Vote Up Vote Down


 

@BetL925

After experimenting and fixing it, the "Non-Empty Browsing Instance" seems to be triggered by JavaScript changing DOM in the prerendered page.
The way to solve it is to block such JS until the document is visible. Hint:

var visibility = {
isHidden: function() {
if ('hidden' in document) return document.hidden;
return false;
}
};

if (visibility.isHidden()) document.addEventListener('visibilitychange', startWhenVisible);
else startStuff();

function startWhenVisible(){
if (!visibility.isHidden()) {
document.removeEventListener('visibilitychange', startWhenVisible);
startStuff();
}
}

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme