jQuery .ready in a dynamically inserted iframe

后端 未结 10 2011
闹比i
闹比i 2020-11-22 07:11

We are using jQuery thickbox to dynamically display an iframe when someone clicks on a picture. In this iframe, we are using galleria a javascript library to display multip

10条回答
  •  长情又很酷
    2020-11-22 07:31

    I'm loading the PDF with jQuery ajax into browser cache. Then I create embedded element with data already in browser cache. I guess it will work with iframe too.

    
    var url = "http://example.com/my.pdf";
    // show spinner
    $.mobile.showPageLoadingMsg('b', note, false);
    $.ajax({
        url: url,
        cache: true,
        mimeType: 'application/pdf',
        success: function () {
            // display cached data
            $(scroller).append('');
            // hide spinner
            $.mobile.hidePageLoadingMsg();
        }
    });
    

    You have to set your http headers correctly as well.

    
    HttpContext.Response.Expires = 1;
    HttpContext.Response.Cache.SetNoServerCaching();
    HttpContext.Response.Cache.SetAllowResponseInBrowserHistory(false);
    HttpContext.Response.CacheControl = "Private";
    

提交回复
热议问题