HTML table shows for split second before Datatable is rendered

HTML table shows for split second before Datatable is rendered

sprockettsprockett Posts: 12Questions: 0Answers: 0
edited January 2012 in DataTables 1.8
Hi, when i load the page, the HTML table is shown for a quick second, before the Datatable is rendered over it.

What is the best way to smoothly display ONLY the datatable (ie. do not display the HTML table first, and only render the datatable?

Thanks!

Replies

  • sprockettsprockett Posts: 12Questions: 0Answers: 0
    I have tried setting the html table to "display: none", and then manually setting it back (via js) to display: block after table has rendered.

    This works to a certain extent, but there is still a "flicker" where the page is blank, and then the datatable appears.

    Is there a more elegant solution?

    Thanks!
  • sbenavidessbenavides Posts: 1Questions: 0Answers: 0
    Did you ever find a solution for this problem? I am experiencing the same thing
  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin
    This Flash Of Unscripted Content is a significant problem for all web-devs when working with anything other than trivial Javascript. If you google for "fouc unscripted" you'll see a lot of posts addressing this issue. Certainly one way of dealing with it is to show a 'loading' element covering the page, or hide the content (although that has an IE health warning, it will seriously slow down IE6/7).

    There is no trivial solution though I'm afraid. The browsers have to walk a fine line between showing content as quickly as possible and not showing the FOUC (styled or scripted). The best way is to optimised your site as much as possible (use page speed for example and aim for all As :-) ).

    Allan
This discussion has been closed.