user1684100
user1684100

Reputation: 31

Multiple concurrent iframes on page

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?

Upvotes: 3

Views: 1451

Answers (3)

Emre Sakarya
Emre Sakarya

Reputation: 122

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.

Upvotes: 0

Jerod Venema
Jerod Venema

Reputation: 44652

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.

Upvotes: 2

Diodeus - James MacFarlane
Diodeus - James MacFarlane

Reputation: 114417

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

Upvotes: 0

Related Questions