简体   繁体   English

出现错误未捕获的 ReferenceError: firebase 未定义

[英]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:-

<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:-我的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未捕获的引用错误:firebase 未定义 2021 年 1 月 12 日下午 3:58:58 /Database.js:14:1


I have even copied and pasted some other scripts to html as they where written in Docs我什至将其他一些脚本复制并粘贴到 html 中,因为它们是在 Docs 中编写的

Try adding the script of firebase-app too也尝试添加 firebase-app 的脚本

<script src="https://cdnjs.cloudflare.com/ajax/libs/firebase/8.2.2/firebase-app.min.js"></script>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM