title: Firebase Database code not working after window.location is inserted in JS
body: <p>This is the code of JS file makeroom.js-
  The database part doesn't work after the window.location code is put. Any solutions?</p>
  <pre><code>var firebaseConfig = {
      apiKey: &quot;AIzaSyD96Lgszg8M9TptKknYlfnCDsEfy9ZO2dQ&quot;,
      authDomain: &quot;hwforfirebase.firebaseapp.com&quot;,
      databaseURL: &quot;https://hwforfirebase.firebaseio.com&quot;,
      projectId: &quot;hwforfirebase&quot;,
      storageBucket: &quot;hwforfirebase.appspot.com&quot;,
      messagingSenderId: &quot;297251167674&quot;,
      appId: &quot;1:297251167674:web:ac070375a455971c7b1183&quot;,
      measurementId: &quot;G-Z7PPXV5NEJ&quot;
  };
  // Initialize Firebase
  firebase.initializeApp(firebaseConfig);
  
  document.getElementById(&quot;greeting_para&quot;).innerHTML = &quot;Welcome,&quot; + &quot; &quot; + localStorage.getItem(&quot;NameForChatApp&quot;) + &quot; &quot; + &quot;!&quot;;
  function addRoom(){
        RoomName = document.getElementById(&quot;makeroom_input&quot;).value;
        localStorage.setItem(&quot;Room Name&quot;,RoomName);
  
        firebase.database().ref(&quot;/&quot;).child(RoomName).update({
              purpose: &quot;Adding Room Name&quot;
        });
  
  
        window.location = &quot;chatscreen.html&quot;;
  
  
  
  }
  </code></pre>