This is a migrated thread and some comments may be shown as answers.

IE11 Iframe Print Issue - Assistance Appreciated

1 Answer 214 Views
Window
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 10 Jan 2014, 08:08 PM

We have a project in production where we implemented a simple RadWindow and allow the iframe content to be printed. 

This has worked fine for years, but since IE11 the print functionality has stopped working.  I tried upgrading to the latest Telerik suite but it did not fix the issue.

Here is the snippet I am using to accomplish the printing which is almost a literal copy from the Telerik examples (which works in every IE prior to 11, Chrome, and Firefox for us)

<script type="text/javascript">
 
    function PrintIframeContent() {
        var oWindow = GetRadWindow();
        var content = oWindow.GetContentFrame().contentWindow;
        var printDocument = content.document;
 
        if (document.all) {
            printDocument.execCommand("Print");
        } else {
            content.print();
        }
    }
 
    function GetRadWindow() {
        var oWindow = null;
 
        if (window.radWindow) oWindow = window.radWindow;
        else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
 
        return oWindow;
    }
 
    function CloseWin() {
        //Get the RadWindow 
        var oWindow = GetRadWindow();
 
        //Call its Close() method 
        oWindow.Close();
    
</script>

I can see the code is getting executed when debugging but it does not fire an actual print command in the browser (to show the print dialogue).  

If I force my IE11 browser into IE10 Document Mode then everything works as expected. 

For some reason the content.print()  seems to do nothing now under Edge mode.  Oddly enough if I use the other function from the JavaScript printDocument.execCommand("Print") then everything works fine in IE11 Edge mode.  

Can someone explain what is going on here as this has been in production and working for years until this, and I had to implement this change not knowing why this is now happening.

Also a side note, I had to force my IE11 browser into IE10 Document Mode emulation on this page also to even get the RadEditor menu items to show so I could use/see the 'Format Code Block' option.

Thank you please advise

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 13 Jan 2014, 03:53 PM
Hello John,

I have just answered your support ticket with the same question. For anyone else that may stumble upon such an issue, here are my findings:

It would seem registering the script from the code-behind would not work with IE11. I am attaching here the content page as I tried it with server code. My best guess at this point is that IE11 needs a user action (click) to allow the printing to trigger, which is not present in a script registered from the code-behind. You can also find attached a simpler version of this with a simple iframe as a reference.

Regards,
Marin Bratanov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Window
Asked by
Robert
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or