Load PDF files in a frame RRS feed

  • Question

  • User1867197125 posted


    Hi misters,

    I have a aspx page that loads PDF files into a frame (I call an ShowFile.aspx file that uses Response.BinaryWrite).

    I want that the user can see div with the message loading and finished it when the PDF file have been loaded.

    I have onload function for iframe but doesn't work, because never is called. Appears progress bar in IE 6.0 but not go up.

    Any solution about it, please?

    Thanks in advance, greetings

    <iframe src=""







    Wednesday, June 18, 2008 7:11 AM


All replies

  • User537870505 posted
    It does work for me. Here is what I tried: 
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    <title>Welcome Home</title>

    <script language="javascript" type="text/javascript">
    function showMsg()
    document.getElementById("msg").innerHTML = "Finished";

    <form id="frmDefault" method="post">
    <iframe src="http://www.microsoft.com" onload="showMsg();"></iframe>
    <div id="msg">Started downloading...</div>
    Initially the DIV is set to "Started downloading..." and it shows "Finished" after fully loading the IFRAME.
    Wednesday, June 18, 2008 7:42 AM
  • User1867197125 posted

    Hi mister, if I try load pdf doesn't work onload event for Iframe:

    Any suggestion about it ??


    <html xmlns="http://www.w3.org/1999/xhtml"><head runat="server">

    <title>Welcome Home</title>

    <script language="javascript" type="text/javascript"> function showMsg() { document.getElementById("msg").innerHTML = "Finished"; }


    function loadIframe()


    document.getElementById("msg").innerHTML = "Started";

    document.getElementById("iframe1").src = "http://www.google.com";



    function loadIframe2()


    "msg").innerHTML = "Started"; document.getElementById("iframe1").src = "http://localhost/ConsultaOperaciones/ficheros/00000007.pdf";






    <form id="frmDefault" method="post">


    <a href="#" onclick="loadIframe();">Load</a>

    <a href="#" onclick="loadIframe2();">Load2</a>

    <iframe id="iframe1" src="http://www.microsoft.com" onload="showMsg();"></iframe>

    <div id="msg">Started downloading...</div>




    Wednesday, June 18, 2008 8:47 AM
  • User-1763611275 posted


    try this

     <IFrame runat="server" id="iframepdf" style="width: 632px; height: 544px; background-color: silver;" visible="false">

    do the following in you code behind

    iframepdf.Attributes.Add("src", "PATH OF THE FILE")


    Good Luck

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, June 19, 2008 3:09 AM
  • User-1094731319 posted

    Hi alhambraeidos,

    Did you manage to find the solution for your problem? if yes, please share with me as im experiencing the same problem.

    Thanks in advance

    Wednesday, July 7, 2010 1:57 AM