Resolving the contents of an IFRAME load sometimes shows that it is sometimes not displayed

Source: Internet
Author: User

This is a problem encountered in the ASP. NET MVC project, assuming that the parent page has an IFRAME

<iframe id="sth" src="" scrolling="no" frameborder="0" width="100%" height= " 100% "></iframe>

The src attribute of the IFRAME triggered by a button on the parent page points to a URL:

var url = "/somecontrollername/someactionname";
$ ("#sth"). attr ("src", url);

By someactionname This action-rendered view, called a sub-page. When the parent page button is first triggered to load a child page, the content of the child page is fully displayed, and then the parent page button is triggered again, but the content of the child page is not displayed.

The best solution ...

Perhaps, what happens when a child page is loaded and then refreshed again? Try the following on the sub-page:

    < 0) {
        window.location = Window.location.href + '? loaded=1 '
    }
});

Problem Solving! But, why? :-P

Resolving the contents of an IFRAME load sometimes shows that it is sometimes not displayed

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.