Cloud Firestore supports offline persistence, even for web applications: https://firebase.google.com/docs/firestore/manage-data/enable-offline
It seems to me that this feature is not available in the real-time database. I couldn't find anything related in the docs.
Does the real-time database have persistence?
Please note that this concerns the web version of the real-time database. I know that offline persistence and caching is a key feature for the Android SDK etc.
If you look at the docs for enabling offline capabilities
for Android
and web, they are very different. For Android, you can find instructions on disk persistence. For the web, you only get information on connection/disconnection events.