Solved

Unable to call Print Dialog in Firefox, Works in IE

Posted on 2012-03-14
1
463 Views
Last Modified: 2012-03-14
I have a jquery ui dialog that appears to client with Printer Friendly content.  The dialog box contains two buttons, 'Print' and 'Cancel'.  The Print button contains the standard javascript command to call the print dialog button.  This function works in IE but not in Firefox.  What needs to be done differently for?

see code:
    //Build function to handle Printable Pages
    function openPrintDialog(divName, iframeID, ajaxUrl, displayTitle, defaultWidth, defaultHeight, openStatus, page, iframeWidth) {
        //this dialog is used to show the printable version of the Client Record
        var $dialog = $('<div id="' + divName + '"></div>')
                .html('<iframe id="' + iframeID + '" style="border: 0px; " src="' + page + '" width="' + iframeWidth + '" height="' + defaultHeight + '"></iframe>')
                .dialog({
                    autoOpen: openStatus,
                    title: displayTitle,
                    width: defaultWidth,
                    height: defaultHeight,
                    modal: true,

                    //Define Buttons
                    buttons: {
                        Print: function () {
                            var objFrame = window.frames[iframeID];
                            objFrame.focus();
                            objFrame.print();

                            //Now close dialog
                            $(this).dialog('close');
                        },
                        Close: function (ev, ui) {
                            clearPrintIframe('#' + iframeID);
                            $(this).dialog('close');
                        }
                    }
                });                     //end of Dialog w/options
        $dialog.dialog('open');

    };  //End of openPrintDialog Function
0
Comment
Question by:Robert Treadwell
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
Robert Treadwell earned 0 total points
ID: 37720209
Answered this one my self.  Changed the Print section to determine the browser type and then changing print functionality to fit the browser type.

                        Print: function () {
                            var nav = navigator.appName;
                            if (nav == "Microsoft Internet Explorer") {
                                var objFrame = window.frames[iframeID];
                                objFrame.focus();
                                objFrame.print();
                            } else if (nav == "Netscape") {
                                $('#' + iframeID)[0].focus();
                                $('#' + iframeID)[0].contentWindow.print();
                            }
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question