SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot
    Join Date
    Jun 2006
    Posts
    186
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to display a loading indicator while the page loads serverside?

    Pages are loaded into an iframe on my website, and each page can take a little awhile to load (at least under high server load) as it queries the database. Is there any easy way to have the php page return a loading indicator gif to the viewers browser before it continues to process the php page server side?

    It would be great if I could do something like this, as long as it doesn't create more load for my server (such as having the requested page display an indicator then do an ajax call to another file. This would accomplish what I need, but it seems like that would double the number of pages being requested from my already overloaded server).

    Thanks
    Gabe

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,871
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Any loading indicator will require additional JavaScript to work the indicator and hence will make the page load more slowly than it would without the indicator.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,269
    Mentioned
    196 Post(s)
    Tagged
    2 Thread(s)

    "loading"

    To have a loading indicator reach the browser before the request reaches the browser will either require javascript to show an already loaded "hidden" element, AJAX, or a preliminary "splash" page that reloads to the "real" page..
    AFAIK, most browsers have a "loading bar" that indicates the stage of a page download, but I wonder how many people even notice it. MHO javascript sounds like your best option.

  4. #4
    SitePoint Zealot
    Join Date
    Jun 2006
    Posts
    186
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I see, I think most people assume its loading... just thought I'd try to add some kind of indicator for those that might not.

    I might give the ajax a try though, I'm not exactly sure if adding an extra, but small, page load for every request will make too much of a load difference.

    EDIT: I just realized that I could probably just have a hidden loading animation placed over the iframe, and make it visible when the link is pressed, then have some js in the iframed page make the animation disappear. I'll give that a shot.

  5. #5
    SitePoint Member
    Join Date
    Feb 2009
    Location
    Atlanta, GA
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If any one reading this thread..
    Please help me in similar problem at:

    http://www.sitepoint.com/forums/show...36#post4173636


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •