Artem Artem - 2 years ago 353
Javascript Question

JavaScript question

It is possible not to show html page in user browser until some JavaScript(built-in or in separate file) will be loaded and executed(for page DOM manipulation)?

Answer Source

The easiest thing to do is to set the css variable

display: none;

to the whole page. then when everything is loaded you can set the display to

display: block; // or something else that suits.

If you make sure that piece of CSS is loaded at the very start of your document it will be active before any html is shown.

if you use a javascript library like jQuery you'll have access to the $(document).ready() function, and can implement a switch over like this:

        <style type="text/css">
            body > div {
                display: none;
        <script type="text/javascript">
            $(document).ready(function() {
                $('body > div').css('display', 'block');
            This will initially be hidden.
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download