I am facing issues in invoking a javascript from the SWT code.
The javascript code is written to initialize the scanner.
I create a new instance of org.eclipse.swt.browser.Browser and
boolean setUrl= htmlBrowser.setUrl(<html file path>
;
setUrl returns true.The HTML file sets some global javascript variables.
boolean result=htmlBrowser.execute("scanner_id=\"<object id=WebScanner classid='clsid:2FB3B04B-DE1A-11D2-9543-00A0C996209D' OnDataEvent(Status)='WebScanner_OnDataEvent(Status)'><param name='allowScriptAccess' value='sameDomain'/> </object>\";");
boolean result1=htmlBrowser.execute("document.body.insertAdjacentHTML('AfterBegin', scanner_id);");
result returns true and result1 returns false.
If i add htmlBrowser.execute("alert('
test');"); before result1, then i get result1 also to be true.
The scanner gets initialized properly.
I understand that it is weird,but am clueless on why this happens.
Is there any way to get rid of the alert statement and still get result1 as true??
Any pointers are truly appreciated.
Thanks!!