Thursday, June 20, 2013
 

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!

 

About the Author

This post was written by . Richie is a computer engineering student and the founder of techwithric.com. He blogs on softwares, wordpress, web-design, start-ups and random thoughts! He's also a author at Devil's Workshop. Follow him on twitter @richiesajan.

Tags: , , , , ,

Comments: 8

Leave a reply »

 
  • 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

     
     
     
  • 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

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

    please advise,
    Thanks!

     
     
     
    • Hi Gal,
      did you follow the procedure exactly as given here? If your still not getting it right, could you provide more details like the exact error your getting?

       
  • 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 (:

     
     
     
    • 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.

       
  • Works like a charm.
    Pro as usual!

    (you should get that copy code feature)

    Thanks (:

     
     
     
  • Leave a Reply
     
    Your gravatar
    Your Name
     
     
     

     
     
 
About Tech With Ric

TechWithRic.com – a blog dedicated to make your tech lives easier!

Learn more »
Follow Us (RSS)
Get in touch

Phone: +91 8767 216 799
Email: mail@techwithric.com

Online contact form »