views:

29

answers:

1

In which case webpage loads without external stylesheet in chrome or safari ?

I am talking about a case in which webbrowser first loads webpage without stylesheet and then redraw it with css once it becomes available.

It would be great If you give me a small html page with external stylesheet, which always loads webpage without external stylesheet.

I am a webkit developer and want that case to do some development in webkit engine.

+1  A: 

I believe that this is always the case. In other words, CSS files are always loaded asynchronously, and when they become available they are stored in the broser and applied to the existing DOM.

If you are interested in slow loading files, you can simulate this and see how your browser behaves. Best way is the following: get yourself a php and apache installation (say XAMPP), instruct Apache to handle .css files as php files (i.e. execute php code in css files), create a new css file and at its to add <? sleep(20); ?>. This will cause the css file to be delayed by 20 seconds, effectively simulating the slowloading.

Other than that, you could also wish to load a CSS file after the page is already loaded. Here you can find an example: http://www.cssnewbie.com/simple-jquery-stylesheet-switcher/

Palantir
Hi I tried this by making cssstylesheet of 1gb, in this case, webpage keeps on loading. Any Idea why?
Sunny
That's an idea, but you are very likely to cause a series of problems, especially with memory consumption and DOM getting enormous...
Palantir
Thanks for your continuous help, I can not understand that why with 1 gb of css file, webpage keeps on loading and does not display webpage without external stylesheet.
Sunny
Actually, doing the time-delay-via-PHP results in the very same behaviour: the page just hangs loading, then immediately renders in the correct styling when the CSS file is downloaded. That's in Firefox 3.6, safari 4, and IE 7. To get the 'render plain, then apply stles' behaviour, you'd need to dynamically 'inject' the CSS via javascript, as suggested.
Bobby Jack