Jump to content

Wait until iframe finish loading, then resume code


everisk

Recommended Posts

Hi,

 

I have a code where I need to use an IFRAME to load something from external page then display that the process has succeeded, then a message shows that user can close the browser. Now I'm using sleep() to delay the page (and hope that the IFRAME will finish loading within that time). But I dont think this is working as different people have different connection speed.

 

Below is the short version of my code. Many thanks in advance!

 


echo "<div align=center><iframe src='http://xxx.com' frameborder=\"0\" width=\"1\" height=\"1\"></iframe></div>";
echo "<div align=center><iframe src='http://www.xxx.com' frameborder=\"0\" width=\"1\" height=\"1\"></iframe></div>";
sleep(10);
echo "<div align=\"center\">Success!</div>";

 

Do you realise how php works? When php echo's or print's, it put's this on the file stream that is being returned to the client browser, therefore the iframe statement won't be executed untill it is client side... You could use php to read the file and dump it to the client inline, or maybe use some form of javascript on the clientside...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.