0

I keep getting this error in the browser console. A few seconds later another error shows up, Uncaught Document body has not initialized. Wait to initialize Firebase until after the document is ready, and keeps repeating every few seconds.

I dropped the firebase hosted library and config object just before the close of the </body> exactly as indicated.

The HTML file is hosted on firebase.

Any idea what I am doing wrong? enter image description here

UPDATE: I've narrowed it down to Material Design Lite interaction. The MDL templates take Firebase fine but my MDL page throws these errors. I've validated the HTML with the W3org validator, ...still troubleshooting.

    <script src="https://www.gstatic.com/firebasejs/live/3.0/firebase.js"></script>
    <script>
    // Initialize Firebase - the BLAH BLAH is not really there
    var config = {
    apiKey: "AIzaSyDBLAH_BLAH_BLAHdtr3kp_9k",
    authDomain: "fir-3-BLAH-BLAH-5c.firebaseapp.com",
    databaseURL: "https://fiBLAH-BLAH-BLAH-18f5c.firebaseio.com",
    storageBucket: "fir-3AND-MORE-BLAH5c.appspot.com",
    };
    firebase.initializeApp(config);
</script>
Ronnie Royston
  • 16,778
  • 6
  • 77
  • 91

1 Answers1

0

The problem was with my coding of Material Design Lite, MDL. I had applied class="mdl-layout mdl-js-layout" to the <body> element and it works just fine, unless you try and use Firebase!

The fix is to not have any MDL class whatsoever in your <body> element.

WRONG

</head>
<body class="mdl-layout mdl-js-layout">
    <!--Main Page -->
    <main class="mdl-layout__content page-content">
        <!--Content Section One -->
        <section class="section-one mdl-grid">

RIGHT

</head>
<body>
    <div class="mdl-layout mdl-js-layout">
        <!--Main Page -->
        <main class="mdl-layout__content page-content">
            <!--Content Section One-->
            <section class="section-one mdl-grid">
Ronnie Royston
  • 16,778
  • 6
  • 77
  • 91
  • I have the same problem, but I already had that fix in place, and it doesn't help. If anyone has another answer, please share! – Rachel Jul 27 '16 at 16:20
  • @Rachel are you sure you have `class="mdl-layout__content page-content"` applied to a `
    `?
    – Ronnie Royston Jul 27 '16 at 20:27