?
Solved

Unable to call Print Dialog in Firefox, Works in IE

Posted on 2012-03-14
1
Medium Priority
?
465 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

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

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

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…
Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer…
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…
Suggested Courses

762 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