Search code examples
reactjshttp-redirectparametersmetadataprerender

Is it possible to prerender before redirect?


I'm utilizing prerender.io service to prerender my React app. In the app I have a transitional page to send to the prerender.io parametrised metadata and then redirect to the app's main page.

The problem is that it seems that the service prerenders the destination page (the app's main page) with its metadata instead of transitional one.

Question: how to prerender transitional page with its metadata?


Solution

  • So with the javascript redirect happening immediately, the Prerender server is thinking the page is still loading so it does not check the meta tags until after the javascript redirect is complete.

    The best solution here is to delay the javascript redirect for ~5 seconds for a Prerender browser but to allow the javascript redirect to happen immediately for a normal user.