I have a CefSharp browser control that loads a page running javascript EventSource(). The page adds an element each time a message is returned by event source. How can I tell once this element has been added? The event stream never ends so I don't think I could do it with any loading complete handlers. Something like OnHTMLContentChanged is what I am looking for. Below is the html of the webpage. When this happens (document.getElementById("result").innerHTML += event.data + "<br>")
, I need my c# code to know.
<!DOCTYPE html>
<html>
<body>
<div id="result"></div>
<script>
if(typeof(EventSource) !== "undefined") {
var source = new EventSource("https://example.com/api/stream");
source.onmessage = function(event) {
document.getElementById("result").innerHTML += event.data + "<br>";
};
} else {
document.getElementById("result").innerHTML = "Sorry, your browser does not support server-sent events...";
}
</script>