Reputation: 1
After firebase hosting , I got error "firebase is not defined". I tried using api key but It doesn't work too.
I pasted the below code to my index.html
<!-- update the version number as needed -->
<script defer src="/__/firebase/7.4.0/firebase-app.js"></script>
<!-- include only the Firebase features as you need -->
<script defer src="/__/firebase/7.4.0/firebase-auth.js"></script>
<script defer src="/__/firebase/7.4.0/firebase-database.js"></script>
<script defer src="/__/firebase/7.4.0/firebase-messaging.js"></script>
<script defer src="/__/firebase/7.4.0/firebase-storage.js"></script>
<!-- initialize the SDK after all desired features are loaded -->
<script defer src="/__/firebase/init.js"></script>
<script src="/javascripts/sessionchk.js"></script>
sessionchk.js >>
firebase.auth().onAuthStateChanged(function(user) {
if (user) {
document.getElementById("loginmenu").textContent = "logout";
document.getElementById("loginmenu").href = "/logout";
} else {
document.getElementById("loginmenu").textContent = "login";
document.getElementById("loginmenu").href = "/loginform";
}
});
what am I missing now???
Upvotes: 0
Views: 91
Reputation: 26343
You need to add a defer
attribute to your <script>
tag -- as-is it is loading before the rest of the scripts.
Upvotes: 1