Make async event synchronous in JavaScript

后端 未结 5 1759
迷失自我
迷失自我 2021-01-14 04:06

I\'m using the WPF 3.5SP1 WebBrowser control to display a page containing some javascript functions. My program then needs to invoke a javascript function which will make an

5条回答
  •  再見小時候
    2021-01-14 05:08

    Is there a way I can make the first javascript function sleep until something happens (with out locking up the browser)?

    In the way that you're expecting it to work, no.

    AFAIK, thread control or continuous looping are needed -- the first is unavailable in JavaScript and the latter will lock up most browsers.

    I think you'll need to have JavaScript send result to the server with Ajax (from some-async-function-complete). Then, break up your C# to have one part call myscript and another respond and process result.

提交回复
热议问题