Solved

Unable to call Print Dialog in Firefox, Works in IE

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
This article discusses how to create an extensible mechanism for linked drop downs.
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…

786 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