Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
596 views
in Technique[技术] by (71.8m points)

javascript - 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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...