WPF webbrowser's LoadCompleted event

后端 未结 3 1528
面向向阳花
面向向阳花 2021-01-21 12:26

When will the WPF webbrowser\'s LoadCompleted event fires? Is this event waits for any ajax calls to complete in the aspx page.

i have a wpf app in which a webbrowser co

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-21 12:49

    The documentation for the LoadComplete event states:

    Occurs when the document being navigated to has finished downloading.

    This means that when the url is done downloading it will fire. It does *not mean that any of the referenced items will trigger the event (images, scripts, etc).

    Additionally, unless you hook into the JavaScript engine itself (which I'm not aware if you can do) to be notified when a call is made back to the web server, it can't be guaranteed that it's an Ajax call; there's no standard around the calls and usually the calls for Ajax are different across the various libraries that you use.

    For example jQuery uses the ajax() method, while scriptalicious wraps calls internally and doesn't give you a way to make Ajax calls outright.

    Or, you can make calls using the XMLHttpRequest object directly.

    Even if you could narrow it down to calls using XMLHttpRequest, you wouldn't know which calls are for Ajax; the URLs that can be called don't indicate whether they are Ajax or not, nor does the content type returned (plain text, XML, JSON).

提交回复
热议问题