3

I have four iframes on a page that need to process independent code. Each one takes approx. 5 to 15 seconds to process, but I have not been able to make them run concurrently. They always start/stop sequentially. I know new browser should have up to 6 connections, but I cannot get past 2.

Any ideas?

David Fullerton
  • 3,164
  • 25
  • 37
  • 1
    Do you mean they're not loading concurrently or that they're not running their scripts concurrently? – Jacob Sep 19 '12 at 20:04
  • The scripts are not running concurrently, I am printing the time on entry and on exit in PHP and the four never overlap. They are always sequential and start randomly... – user1684100 Sep 19 '12 at 20:08
  • Do you have sessions in your PHP script? – jvenema Sep 19 '12 at 20:12

3 Answers3

2

You're probably not hitting client limits, but server ones.

See this answer: Simultaneous Requests to PHP Script

Note the section in there about PHP sessions. The session will request a file lock, which will block all other requests using that session until the script ends and the file lock is released. Thus, sequential processing.

Community
  • 1
  • 1
jvenema
  • 42,243
  • 5
  • 64
  • 107
0

If you're starting the scripts when the pages load, they'll never synch up. You need each of them to tell some "master script", perhaps in the wrapping page, that they're loaded, and when they all are, run the main function in each.

parent.startScripts() // in iframe page

then, in the wrapper page, something like:

int sCount=0
function startScripts() {
    sCount++;
    if(sCount==4) {
       //..call start function is each iframe ..
    }
}
Diodeus - James MacFarlane
  • 107,156
  • 31
  • 147
  • 171
0

You can use Local Connection on iFrames to call scripts at correct time.

once all your iframes connected, you can even use just one of them to call script from all other iframes.

Emre Sakarya
  • 122
  • 5