Forum Discussion

Claudius's avatar
9 years ago

last_chance_html versus "Page Hitbox Content" in wrapper

While reviewing the Lithium Hover Cards implementation I stumbed over the special last_chance_html custom component which "will run at the very end of every page load."

 

I was wondering how this differs from the "Page Hitbox Content" in the Studio Community Style Wrapper? According to the help text there this content "will be appended near the end of the body tag on every page."

 

Anyone knows the difference and can share recommendations on when to use which of them?

  • Hi Claudius,

     

    They are both at the end of the page after 99.9% of the HTML before the ending body tag, but they are separated by some JavaScript.   The Page Hitbox content comes first, right after the footer and closing lia-page DIV, and followed by a bunch of Lithium JavaScript code (100+ lines in our pages).  The content in the last_chance_html is literally at the very end because it is placed immediately before the closing </body> tag.  In our case, we put our script tags in the Page Hitbox so they load after the HTML as is usually recommended.   As for last_chance_html, I also use it for the one hoverCard.js file for Lithium's Profile Hover Cards which recommended putting it there, but I'm sure you could use it for other things.   So in our case the page looks like this:

     

    <html><head>[...typical header stuff...]</head>
    <body>
      <div class="lia-page">
        <center>
    [...all page content including header and footer...]
        </center>
      </div>
    
    [...Page Hitbox content goes here...]
    
    [...Next, lots and lots of Lithium JavaScript code...]
    
    [...last_chance_html content goes here...]
    
    </body>
    </html>

     

    Hope that makes sense.

     

    Robert

    • ChiaraS's avatar
      ChiaraS
      Lithium Alumni (Retired)

      Hi Claudius

      the main difference I think is that the "page hitbox" is part of the skin, while "last_chance_html" is independent from the skin. 

      Depending on what's your use case and your setup (multiple skins or just one), you may want to use one or the other.

       

      I think that in general the usage of the page footer (for html) and page hitbox (for non-visible code, like scripts) is recommended.

       

      • Claudius's avatar
        Claudius
        Boss
        Thanks. That split skin versus generic makes sense and the guidance in your last paragraph is helpful.