0

MY working HTML page written using VB Script, here on click of Button document gets opened . CreateObject is working fine here .

Sub Opensig_OnClick()  
  Dim laccno  
  Dim accno  
  laccno = txtaccno.value  
  Set sigobj = CreateObject("Wrsrv.Document")  
  reStatus = sigobj.Verify(laccno,amt,1)
End Sub

But I have to write code in JSP in which ActiveXObject is not working. Code Written by me:

function Opensig_OnClick(customerId) {
    var str;
    $.ajax({
        url: getContextPath() + "/app/omnidocupload/appDocument/sigcap/accountnumberforsalaryaccount/" + customerId,
        async: true,
        data: {
            custId: customerId
        },
        success: function(responseObject) {
            str = responseObject;
        }
    });
    var sigobj = new ActiveXObject("Wrsrv.Document");
    var reststus = sigobj.verify(str, 0, 1);
}

here on click of button , function Opensig_OnClick is called . but I am getting error at line var sigobj= new ActiveXObject("Wrsrv.Document"); that Automation Server can't create object

Tomalak
  • 332,285
  • 67
  • 532
  • 628
  • ActiveXObject is supported only in Internet Explorer http://stackoverflow.com/questions/25311570/activexobject-in-ie11 – Slai Oct 01 '16 at 13:01
  • I runned this code in IE 8 with all ActiveXObject setting to be enabled as I read from other post . Still this error is coming . Can you Suggest any other way to write this vbscript in javascipt . – Akshata Singh Oct 01 '16 at 13:03
  • Actually set mode as ie 8 while running program on ie11 – Akshata Singh Oct 01 '16 at 13:11
  • Changes done as per suggestion Still not working – Akshata Singh Oct 03 '16 at 04:58
  • You are confused how asynchronous code works. In your code, `str` will not contain any value on the line `var reststus = sigobj.verify(str, 0, 1);`. Move the two last lines into the `success` callback. – Tomalak Oct 04 '16 at 12:11
  • Regarding the "Automation Server can't create object" error, this could be due to zone restrictions in IE. Make sure that the page is running in a zone that is allowed to create ActiveX objects. See http://stackoverflow.com/questions/4153841/activexobject-creation-error-automation-server-cant-create-object – Tomalak Oct 04 '16 at 12:23

1 Answers1

0

Button works fine after following setting done in ActiveX controls and plug-ins at location internet Option -> Security -> Custom level .

  1. Allow ActiveX Filtering Disable .

  2. Make all other properties of ActiveX present there as Enable . especially Download unsigned ActiveX control and Initialize and script ActiveX Control not marked as Safe .

On making all these features Enable .You will get message that your computer is at risk . But To run this You have to this setting .

This will only run on IE8 .