1

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?

  • You can prerender whole site? Isn't it just that only one page can be prerendered? – Josip Ivic Jul 14 '16 at 8:08
  • Usefull reading -> stackoverflow.com/questions/26387612/… – Josip Ivic Jul 14 '16 at 8:08
  • @JosipIvic I think I was clear: "the page I'm suggesting gets prerendered". And I've seen the question you recommended for reading. What I need is a clear explanation of the "Non-Empty Browsing Instance" message, to shed some light on why exactly this specific page gets aborted and loaded again after it has been prerendered. – Ivan Čurdinjaković Jul 14 '16 at 10:33
  • I'm voting to close this question as off-topic because it's about programming for the browser and belongs on stackoverflow. – Rob Mar 15 '17 at 10:05
1

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();
    }
}
| improve this answer | |
1

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.