NetTalk Central

Author Topic: page deformats while browse loads  (Read 2716 times)

ccordes

  • Sr. Member
  • ****
  • Posts: 384
    • View Profile
    • Email
page deformats while browse loads
« on: January 07, 2012, 10:34:30 AM »
I've had this issue from day-1 so I think I may be missing something simple.
When I have a browse that takes a while to load, the menu and index page get display without any css formatting. Once the browse completes, everything formats properly, but in the meantime, every menu choice is shown and is active. Things that should be hidden are displayed as a normal list.

This is especially bad when I use a form to filter the browse.

Any suggestions? Can I get the index and menu to complete before the browse starts?

Thanks,
chris
« Last Edit: January 07, 2012, 10:37:31 AM by ccordes »
Real programmers use copy con newapp.exe

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: page deformats while browse loads
« Reply #1 on: January 09, 2012, 12:46:53 AM »
Hi Chris,

This is known as a FOUC (http://en.wikipedia.org/wiki/Flash_of_unstyled_content).
And you're right it's been in since the beginning. It's worse in some cases than in others, because what you're seeing is the page before the JavaScript is applied, then again after the JavaScript is applied.

It's probably possible to fix this by hiding the whole page until the JavaScript completes, and then unhiding it. Unfortunately this can have unwanted side-effects though as some JavaScript replies on things being "visible" in order to calculate their height & width etc.

The second side-effect is that the page appears to take longer to load - at least to the user. Allowing them to see the html as it arrives, and as the page is constructed, can be helpful in convincing them that "something is happening". Of course the effect is magnified on slow connections (especially if the JavaScript files are not yet in the cache). and it's also magnified if the JavaScript does intensive page layout work (like the NetWebYear stuff.)

While there's no perfectly "right" approach here it is something I try and investigate from time to time.

Cheers
Bruce