HTML Embedded PDF's & onload

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

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



        
      
      
      
8条回答
  •  礼貌的吻别
    2020-12-24 07:09

    You are going to want something like jQuery's document.ready() function. For non-IE browsers, you can register a handler for the event DOMContentLoaded, and your handler function will be called after all the images and objects have been loaded. For IE, you have to continually check the document.readyState property, and wait for it to be "complete".

    If you are using jQuery, they've done the hard work for you, so all you have to do is:

    $(document).ready(function() {
        //take away the "loading" message here
    });
    

    If you don't want to use jquery, you'd have to do something like:

    addEventListener('DOMContentLoaded', function() { 
        //take away the "loading" message here
    });
    
    function waitForIE() {
    
        if (!document.all) return;
    
        if (document.readyState == "complete") {
            //take away the "loading" message here
        }
        else {
            setTimeout(waitForIE, 10);
        }
    }
    
    waitForIE();
    

提交回复
热议问题