4 ms·
There is the page visibility API: http://www.w3.org/TR/2011/WD-page-visibility-20110602/ http://www.w3.org/TR/2011/WD-page-visibility-20110602/ Supported in C
by Tomdarkness 13y ago
There is the page visibility API:
http://www.w3.org/TR/2011/WD-page-visibility-20110602/ 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_experience/Using_the_Page_Visibility_API 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.
- bjackman 13y agoSo 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!
- Tomdarkness 13y agoHow 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.