开发者

How to make sure a page appears once the iFrame on the page has loaded first

I'm pretty new to the world of web developing and web design in PHP, but I was hoping that someone could help me with my question.

I am loading a particular page on my PHP powered webs开发者_开发技巧ite which loads an iframe from another page elsewhere in the center of the page. I was wondering if anyone knows how to only get the whole page to load once the iframe has loaded. It's only a matter of a further one or two seconds before the iframe loads, but this needs to look as professional as possible.

I'd appreciate any help. I'd also like to assure you guys that although this is my first question, I know how Stack Overflow works as one of my best friends is a contributors here and he's always telling me how annoying it is when people don't respond or give points to good answers, so I'd like to assure you that I will do that.

Thanks again. Steve.


Use JQuery. You won't be able to do this in PHP, as it's a client side issue.

function callIframe(url, callback) {
    $(document.body).append('<IFRAME id="myId" ...>');
    $('iframe#myId').attr('src', url);

    $('iframe#myId').load(function() 
    {
        callback(this);
    });
}

See: jQuery .ready in a dynamically inserted iframe

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜