Feed on Posts or Comments

Code Adam Deacon on 23 Apr 2007 10:38 am

Changing the load order of a webpage

I had an exciting weekend of writing a wonderful ‘webcast’ system. Although it worked fine over the LAN, I found I had a problem when I uploaded it to the internet. The problem as a little weird. The system work by loading a bunch of images then used a version of 1pixelout’s mp3 flash player to play the audio. The problem I had was that half the images were loading, then the flash started loading. A user would then have to wait until the mp3 had finished playing before the final images were loaded.

I searched high and low on the net to see if there was a magical way to control the loading order. In the end I found this really elegant solution to load the flash as the last item.

In your style sheet, give the style you want to appear last: display: none;Then in the body tag change the display to block using onload:document.getElementById('audio').style.display = 'block';"

I’ve tested this in Firefox and IE on both Linux and Windows and it seem to work perfectly.

2 Responses to “Changing the load order of a webpage”

  1. on 04 Jul 2007 at 1:08 am 1./* Cómo modificar el orden de carga de una página web said …

    [...] una forma de alterar el orden de carga de los elementos de la página, he dado con esta idea, que parece ser la solución a nuestros [...]

  2. on 10 Dec 2007 at 7:46 pm 2.Joker said …

    Woo hoo, Adam Deacon, you totally made my day!! :D

    I was kinda losing hope over a slightly different problem, and by adapting your fix to it everything works perfectly!

    And your solution is very elegant indeed. Kudos to you!

Trackback This Post | Subscribe to the comments through RSS Feed

Leave a Reply