SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot 2ndmouse's Avatar
    Join Date
    Jan 2007
    Location
    West London
    Posts
    196
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to detect page-load-complete between iframes - looking for dynamic progress bar

    I have a page containing 2 iframes. The first iframe loads a php/javascript based progress bar. The 2nd iframe loads a php script that runs automatically, scanning all files in a web. On a good day, the script will scan 5000 files in about 8 seconds - the bigger the site the longer it takes. On very large sites it can take several minutes.

    Currently, the duration of the progress bar is determined by the number of files scanned in the previous script run. This is proving to be accurate on occasions and wildly out on other occasions. Depending on server conditions at run time.

    I can't add any html to the script file itself as it is also triggered by cron job - any html in the file is passed to the cron log, which I don't want to happen.

    I'm looking for a way to detect when the script loading in iframe2 has completed its run so I can terminate the progress bar on completion.

    Alternatively, does anyone know of a truly dynamic progress bar? Can't find anything suitable out there. Beginning to think that such a thing doesn't exist.

    Regards
    Detect file changes remotely. SimpleSiteAudit is an early
    warning anti-hacker system which sends an alert on detection.

    PHP Find Orphan Files - Finds all the unreferenced files on your site.

  2. #2
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,747
    Mentioned
    64 Post(s)
    Tagged
    0 Thread(s)
    Wouldnt this simply be a javascript ONLOAD event?
    Never grow up. The instant you do, you lose all ability to imagine great things, for fear of reality crashing in.

  3. #3
    SitePoint Zealot 2ndmouse's Avatar
    Join Date
    Jan 2007
    Location
    West London
    Posts
    196
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi starlion - I presume you mean that the onload event should be added to the script file itself in iframe2, which in turn would send a 'run complete' message to the iframe containing the progress bar.

    The problem is, if I add any html or javascript to the script file, it also appears (in its raw state) in the cron log. So, the method of detecting when the script has finished must be part of the progress bar script in iframe1. I would somehow have to poll iframe2 for the end of script from iframe1.
    Detect file changes remotely. SimpleSiteAudit is an early
    warning anti-hacker system which sends an alert on detection.

    PHP Find Orphan Files - Finds all the unreferenced files on your site.

  4. #4
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,747
    Mentioned
    64 Post(s)
    Tagged
    0 Thread(s)
    Mmh no, i mean the ONLOAD event of an iframe element - which would be inside the page that contains said elements. Iframe2 shouldnt trigger this event until it's page is loaded fully.

    http://www.w3schools.com/jsref/event_frame_onload.asp
    Never grow up. The instant you do, you lose all ability to imagine great things, for fear of reality crashing in.

  5. #5
    SitePoint Zealot 2ndmouse's Avatar
    Join Date
    Jan 2007
    Location
    West London
    Posts
    196
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi starlion - I haven't quite got there yet, but I think your suggestion is going to work. I don't use iframes if I can help it, so I don't know too much about them. Anyway, thanks for the tip.
    Detect file changes remotely. SimpleSiteAudit is an early
    warning anti-hacker system which sends an alert on detection.

    PHP Find Orphan Files - Finds all the unreferenced files on your site.


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
  •