locked
WebBrowserControl Activex problem in windows xp RRS feed

  • Question

  • Hi,

    i create a application with a webbrowser control, when i open my pages in control everything is fine in windows 7 but below function get a error script in windows xp and dont print anything, however this function haven't any problem in IE7 in xp.

    function printPage(){ if (navigator.appName == "Microsoft Internet Explorer") { try{ var PrintCommand = '<object ID="PrintCommandObject" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></object>'; document.body.insertAdjacentHTML('beforeEnd', PrintCommand); PrintCommandObject.ExecWB(6, 2); PrintCommandObject.outerHTML = ""; }catch (e){ window.print(); } } else { window.print(); } }

    function printDiv()
        {
           if(printed > 0){
                return;
            }
            printed = 1;
             var headstr1 = "<";
             var headstr2 = "body>";
             var footstr1 = '</';
             var footstr2 = 'body>';
             var newstr = document.getElementById('rcpt').innerHTML;
             var oldstr = document.body.innerHTML;
             document.body.innerHTML = headstr1+headstr2+newstr+footstr1+footstr2;
             printPage();
             document.body.innerHTML = oldstr;
        }
       }

    so how can i get rid of this error? thanks

    PS. ScriptErrorsSuppressed=true for my control

    • Moved by Eason_H Monday, December 16, 2013 5:38 AM
    Sunday, December 15, 2013 5:41 PM

Answers

  • OK i solve it

    http://msdn.microsoft.com/en-us/library/ms537508.aspx

    You can also enable interactive control blocking by adding your application's process name to the following registry key.

    HKEY_LOCAL_MACHINE (or HKEY_CURRENT_USER)
       SOFTWARE
          Microsoft
             Internet Explorer
                Main
                   FeatureControl
                      FEATURE_ENABLE_ACTIVEX_INACTIVATE_MODE
                         process_name.exe = (DWORD) 0x00000001
    • Marked as answer by Danics Tuesday, December 17, 2013 7:45 AM
    Tuesday, December 17, 2013 7:44 AM

All replies

  • Hi Danics,

    Since the issue regards ASP.NET and website deployment. I suggestion you post the question in the ASP.NET forums at http://forums.asp.net/. It is appropriate and more experts will assist you.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, December 16, 2013 5:38 AM
  • Hi Eason,

    My website is written in JSP so its not related to ASP.net

    i make a windows form application in C# with Webbrowser control inside it so its doesnt mean ASP.net too

    Tuesday, December 17, 2013 7:19 AM
  • OK i solve it

    http://msdn.microsoft.com/en-us/library/ms537508.aspx

    You can also enable interactive control blocking by adding your application's process name to the following registry key.

    HKEY_LOCAL_MACHINE (or HKEY_CURRENT_USER)
       SOFTWARE
          Microsoft
             Internet Explorer
                Main
                   FeatureControl
                      FEATURE_ENABLE_ACTIVEX_INACTIVATE_MODE
                         process_name.exe = (DWORD) 0x00000001
    • Marked as answer by Danics Tuesday, December 17, 2013 7:45 AM
    Tuesday, December 17, 2013 7:44 AM