Check if app is prerendered

Hi,

Is there a way to detect in JS when my app is being prerendered ? Something like a global var ?
I need to deactivate some features in that case, like lazyloading. Otherwise all image tags are rendered without src.

Thanks !

I think you should be able to check the User-Agent. It should have a substring something like HeadlessChrome (I am not sure that is exactly it - so you may want to test).

Thanks !

Is github netlify/prerender the same version as the one used in production ?
Seems like I have broken results with my local server, but it’s working in production.

Wonder if I can test for user agent in local reliably and be sure it’s gonna work on netlify ?

As far as I know that is the same version that is in production, yes. If you continue to see problems &&
you have a specific reproduction case of something that gives inconsistent results that you can distill to a few lines of code, that would be ideal if you’d like help debugging :slight_smile: