Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

There is the page visibility API:

http://www.w3.org/TR/2011/WD-page-visibility-20110602/

Supported in Chrome, Firefox and IE10.

MDN has some information on how to use it:

https://developer.mozilla.org/en-US/docs/Web/Guide/User_expe...

I don't think there is a way server side to detect if the request is for a pre-render or not since I don't think it sends any special headers or anything like that.



So to tell if you're dealing with a pre-render request or an actual view you have to stick a load of AJAX in your page to make another whole HTTP connection from the users browser? Am I missing something here? Because that really sucks!


How else can you deal with it though? The whole point of the prerendering is that it fetches and renders the page in the background to be displayed to the user when they click on the link. You can't handle the prerender request differently because if the user clicks on the link then chrome will just display the prerendered page it fetched earlier and the user would expect to see the exact page as if they had clicked on a non-prerender link.

If the page you are linking to is time sensitive then you should not be using pre-rendering.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: