Georgi Arnaudov
Georgi Arnaudov

Reputation: 427

React app does not render in Facebook in app browser

I have been searching how to solve this issue for a couple of days with no success, so I decided to open a question here. So I have got a React app which uses Redux and Firebase as a database. Everything loads ok in every desktop and mobile browser except Facebook's in app browser. When I open it through my phone their browser fires and gets the title, it loads the injected scripts from Netlify but does not execute any Javascript and I get a blank page.

I have also tried to prerender the app with React Snap and then my app loads, but never preloads the Javascript and therefore the loaded visible content only stays HTML and CSS and nothing Javascript related works.

I am asking for help since I really have no idea what is wrong. There was no errors on build and as I said on every other browser, the web app works.

I have generated the app with create-react-app.

If someone have any suggestions, that would be helpful!

Upvotes: 1

Views: 1415

Answers (1)

Georgi Arnaudov
Georgi Arnaudov

Reputation: 427

Okay I found what caused the app not loading in Facebook's in app browser. The problem was due to the Notifications API and the fact that it is disabled there. My app was using it, therefore it crashed in the beginning and the bundle did not load at all. That is why I had a blank screen on the non prerendered version and no javascript on the prerendered. Both ways there was no JS loaded because of this. So now I just check if the user agent supports the API and run my functions accordingly. Hope it helps to someone with the same issue.

Upvotes: 1

Related Questions