score:0

see https://firebase.google.com/docs/web/setup#add-sdks-initialize

how you add firebase sdks to your app depends on whether you've chosen to use firebase hosting for your app, what tooling you're using with your app (like a bundler), or if you're configuring a node.js app.

  • from hosting urls
  • from the cdn
  • using module bundlers
  • node.js apps

if you use reserved hosting urls, your firebase config is automatically pulled from your firebase project, so you don't need to explicitly provide the object in your code.

it is in case of from hosting urls only.

initialize firebase in your app (no need to include your firebase config object when using reserved hosting urls):

and you should initialize firebase like the following code.

<body>
  <!-- previously loaded firebase sdks -->

  <!-- initialize firebase -->
  <script src="/__/firebase/init.js"></script>
</body>

you can see a __/firebase/init.js sample https://friendly-pix.com/__/firebase/init.js

from hosting urls samples:

could you check the other samples?

score:0

for the firebase sdks to be able to find your firebase project on the servers, it needs certain configuration data. there are multiple ways for it to get this data. in your scenario the two relevant ways are:

  • you can specify the configuration data inside your code with a snippet of json that you copy from the firebase console
  • when you use the firebase emulators and/or deploy to firebase hosting, it can automatically get the configuration data through a "magic" file called /__/firebase/init.js

both these options are also listed in documentation on adding the firebase sdks to a web app under from hosting urls and from the cdn. from that documentation, this is how you auto-configure the loaded sdk:

<body>
  <!-- previously loaded firebase sdks -->

  <!-- initialize firebase -->
  <script src="/__/firebase/init.js"></script>
</body>

Related Query

More Query from same tag