c# - is window.external synchronous or not -


i have discovered window.external object allows call c# function in winform program hosting ie-like browser.

i red doc on msdn , threads on stackoverflow didn't found if calls synchronous or not, and, customable ?

the thing have founded in msdn doc doesn't speak subject =/

these calls naturally synchronous, makes sense process them asynchronously, avoid otherwise possible reentrancy javascript code. use synchronizationcontext.post that.

e.g. call window.external.testmethod() javascript. on .net side may this:

this.webbrowser.objectforscripting = new objectforscripting(this.webbrowser);  // ...  [comvisible(true), classinterface(classinterfacetype.none)] public class objectforscripting {     webbrowser _browser;     synchronizationcontext _context = synchronizationcontext.current;      public objectforscripting(webbrowser browser)     {         _browser = browser;     }      public void testmethod()     {         _context.post(_ =>         {             _browser.document.invokescript("alert", new object[] {                  "process call javascript asynchronosuly." });         }, null);     } } 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -