HTML Why do iframe contents load twice?

In my application, I use the javascript function to set the src tag for the iframe:

function loadDocument(id, doc) {
    $("#DocumentContent").show();
    $("#ButtonBox").show();

    // Clear dynamic menu items
    $("#DynamicMenuContent").html("");
    $("#PageContent").html("");

    // Load document in frame
    $("#iframeDocument").attr("src", 'ViewDoc.aspx?id=' + id + '&doc=' + doc + '');

    // Load menu items
    $("#DynamicMenuContent").load("ShowButtons.aspx");

    // Set document title
    $("#documentTitle").load("GetDocumentInfo.aspx?p=title");
}

When I open Fiddler and debug this page, I notice that the "ViewDoc.aspx" page is called twice.

When I put alert () in the loadDocument function, I get only one warning message. My viewdoc.aspx page has no update or redirect statements or other operators refreshing the page.

Is it possible that this is due to the browser? Is this the default browser behavior?

+3
source share
1 answer

the problem is quite old, but ....

Do you have two elements with id = DynamicMenuContent?

iframe , $( "# DynamicMenuContent" ). load...

, - div, - span, $( "div # DynamicMenuContent" ). load()...

HTH

0

Source: https://habr.com/ru/post/1747348/


All Articles