Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting error Uncaught ReferenceError: firebase is not defined

I have tried too many things and read too many documents but can't find the solution

My html:-

<html>
  <head>
    <script src='https://www.gstatic.com/firebasejs/8.2.2/firebase.js'></script>
   
  </head>

<body onload="Initialize_Firebase()">
  <input type="text/submit/hidden/button/image" id="Name" value="" />
  <input type="text/submit/hidden/button/image" id="Password" value="" />
  <button type="submit">enter</button>
  
  
  
  
  <script src="Config.js"></script>
  
</body>

</html>

My js:-


function Initialize_Firebase(){
  
  var firebaseConfig = {
    apiKey: "** MY API KEY **",
    authDomain: "*****.firebaseapp.com",
    databaseURL: "https://****.firebaseio.com",
    projectId: "****",
    storageBucket: "****.appspot.com",
    messagingSenderId: "16*****54",
    appId: "1:168*****4:web:29d43b******d3a38b",
    measurementId: "G-JBZC**YYV"
  };
  // Initialize Firebase
firebase.initializeApp(firebaseConfig);
  
}

Error log:-

Uncaught ReferenceError: firebase is not defined 1/12/2021, 3:58:58 PM /Database.js:14:1


I have even copied and pasted some other scripts to html as they where written in Docs

like image 456
Priyanshu Kumar Avatar asked Jun 19 '26 21:06

Priyanshu Kumar


1 Answers

Try adding the script of firebase-app too

<script src="https://cdnjs.cloudflare.com/ajax/libs/firebase/8.2.2/firebase-app.min.js"></script>
like image 64
Maheer Ali Avatar answered Jun 22 '26 12:06

Maheer Ali



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!