Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New to the CF scene
    Join Date
    May 2009
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Internet Explorer Iframe not working in IE7

    Hi All,

    Below mentioned code prints properly in Mozila but not in IE7 any help on this would be greatful.

    <HTML>
    <script Language="javascript">

    function printfile()
    {
    for (var i=0; i<window.frames.length; i++)
    {
    //Mozilla
    parent.objAdobePrint.focus();-- Prints in Mozilla & not in IE
    parent.objAdobePrint.print();-- Prints in Mozilla & not in IE
    //IE
    // window.frames['objAdobePrint'].focus();
    // window.frames['objAdobePrint'].print();
    }
    }

    </script>
    <BODY>

    <iframe src="1.pdf" id="objAdobePrint" name="objAdobePrint" height="250" width="100%" frameborder=0></iframe><br>

    <input type="button" value="Print" onclick="javascript: printfile();">



    </BODY>
    </HTML>

    Thanks,
    John

  • #2
    Senior Coder
    Join Date
    Oct 2008
    Location
    Long Beach
    Posts
    1,196
    Thanks
    36
    Thanked 164 Times in 164 Posts
    This works in IE and FF just fine:
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Test</title>
    <style type="text/css">
    </style>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
    <script type="text/javascript">
    // <![CDATA[
    
    function printIframe()
    	{
    	var iframe_window = window.frames["my_iframe"];
    	iframe_window.print();
    	}
    
    // ]]>
    </script>
    </head>
    <body>
    
    <iframe name="my_iframe" id="my_iframe" src="example.html"></iframe>
    
    <input type="button" value="print iframe" onclick="printIframe()" />
    
    </body>
    </html>
    Don't use the "javascript:" string prefix for your onclick definition.
    Feel free to e-mail me if I forget to respond ;)
    ohsosexybrit@gmail.com

  • Users who have thanked itsallkizza for this post:

    john1872 (05-26-2009)

  • #3
    New to the CF scene
    Join Date
    May 2009
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thanks for your quick replay right now printer is not available i will check code by tomorrow & get back to you.Before that inside the iframe i am having the PDF which is having merely 50 pages whether all the pages will be printed by using above attached code?. Kindly let me know.

    Thanks,
    John

  • #4
    New to the CF scene
    Join Date
    May 2009
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Hi,

    Still the same problem: i am having a pdf with 2 pages in FF both pages are printing (By using above suggested code)but in IE7 only single blank page is printing any suggestion would be greatful.
    Thanks,
    John

  • #5
    New to the CF scene
    Join Date
    May 2009
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Hi All,

    Waiting for your suggestions in so many forums above mentioned problem is not answered but i am expecting the answer from this forum & its urgent too.

    Thanks,
    John

  • #6
    New to the CF scene
    Join Date
    May 2009
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Very simple issue it takes too long to fix expecting experts help to solve anyone is there to help me or i want to know is it possible to print multiple page pdf in IE7(inside iframe) any help would be appreciated

  • #7
    Senior Coder
    Join Date
    Oct 2008
    Location
    Long Beach
    Posts
    1,196
    Thanks
    36
    Thanked 164 Times in 164 Posts
    (without testing) i would say that if time is an issue you could simply do what most sites do and give a link to the pdf so the user can choose to view/print it as they wish. then you don't have browser quirks with the printing because it'll be an adobe plugin that does all the work.
    Feel free to e-mail me if I forget to respond ;)
    ohsosexybrit@gmail.com

  • #8
    New to the CF scene
    Join Date
    Jul 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    could you provide a solution if the iframe content is not a pdf but another html(.aspx) page which is longer than 1 page.
    Appreciate any help posted


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •