Tryit Editor v2.3

Edit This Code:
<!DOCTYPE html> <html> <body> <p>The URL of the document that invoked the onmessage event:</p> <div id="myDIV"></div> <p><strong>Note:</strong> Server-Sent Events are not supported in Internet Explorer.</p> <script> if(typeof(EventSource) !== "undefined") { var source = new EventSource("../html/demo_sse.php"); source.onmessage = function(event) { document.getElementById("myDIV").innerHTML = event.origin; }; } else { document.getElementById("myDIV").innerHTML = "Sorry, your browser does not support server-sent events..."; } </script> </body> <!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_onmessage_sse2 by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 23 Jan 2015 08:30:29 GMT --> </html>
Result:
Try it Yourself - © w3schools.com