HTML Embedded PDF's & onload

后端 未结 8 1338
一生所求
一生所求 2020-12-24 06:35

I\'m embedding a PDF in a web page with the following html :-



        
      
      
      
8条回答
  •  半阙折子戏
    2020-12-24 07:32

    I'm loading the PDF with jQuery ajax into browser cache. Then I create embedded element with data already in browser cache.

    
    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";
    

提交回复
热议问题