8

Implement Gmail-Like ‘Loading..’ Functionality on Blogger


Users familiar with Gmail, may have seen the yellowish ‘Loading’ text that appears on top of the page when your Gmail interface is loading. Ever wondered how it would look if you could implement that very same in your own blogger blog? Well look no further, read on. Well to get right down to work:

  • Login to your Blogger Dashboard.
  • Now search for the following tag:

    <body>

  • Now replace this with the following code:

    <body onLoad=’init()’>
    <span id=’loading’ style=’font-weight:bold;position:absolute;font-size:13px; text-align: center; margin-left:auto;top:1px; background-color:#FFD363;’>Loading Page…</span>
    <script>
    var ld=(document.all);

    var ns4=document.layers;
    var ns6=document.getElementById&amp;&amp;!document.all;
    var ie4=document.all;

    if (ns4) ld=document.loading;
    else if (ns6)
    ld=document.getElementById(&quot;loading&quot;).style;
    else if (ie4)
    ld=document.all.loading.style;

    function init() {
    if(ns4){ld.visibility=&quot;hidden&quot;;}
    else if (ns6||ie4) ld.display=&quot;none&quot;;
    }
    </script>

This would give the following effect:

loading

For further customization you could replace the line in the red with the url of an image (eg. Inserting the link ‘http://media.techwithric.com/img/ajax-loader.gif’ would replace the yellowish loading text with the following image) ajax-loader

Have further queries? Please do comment!


Filed in: Blogger, Featured, How-to Tags: , , , , ,

Related Posts

Bookmark and Promote!

8 Responses to "Implement Gmail-Like ‘Loading..’ Functionality on Blogger"

  1. gnesop.com says:

    Your template could not be parsed as it is not well-formed. Please make sure that all XML elements are closed properly. XML error message: Open quote is expected for attribute “{1}” associated with an element type “onLoad”.

    Error 500

  2. Swadesh says:

    Thanks Richie Sajan for such a useful post. Its working nicely.
    I’ve implemented this in my website http://itswadesh.wordpress.com

    Infact i was looking for such a script.

    This small twick can do wonders in user experience

  3. Gal says:

    Hi, for some reason I get an error claims that some tags are open,

    please advise,
    Thanks!

  4. Gal Margalit says:

    Hi Ric,

    Actually I’ve tried several times, error is the following:

    Your template could not be parsed as it is not well-formed. Please make sure that all XML elements are closed properly. XML error message: Open quote is expected for attribute “{1}” associated with an element type “onLoad”.
    Error 500

    Body tags gets approved, the script itself blogger is complaining about.

    Thanks for replying so quickly (:

    • Richie Sajan
      Twitter:
      says:

      The error is rather silly, sorry I didn’t get it the first time. After pasting the code in blogger, just replace the single quotes (‘) for the onLoad parameter in the body tag with apostrophe (unicode: U+0027). For this just type it out using your keyboard, nothing much.

      The problem is that as you copy paste the apostrophe gets parsed into quotes (U+2018 and U+2019.)

      Just try it out and let me know.

  5. Gal Margalit says:

    Works like a charm.
    Pro as usual!

    (you should get that copy code feature)

    Thanks (:

Leave a Reply

Submit Comment

© 2012 Tech With Ric. All rights reserved. XHTML / CSS Valid.