Solved

Unable to call Print Dialog in Firefox, Works in IE

Posted on 2012-03-14
1
452 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
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

jQuery is a JavaScript library that greatly simplifies JavaScript programming. AJAX is an acronym formed from "Asynchronous JavaScript and XML."  AJAX refers to any communication between client and server, when the human client does not observe a…
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
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…

757 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now