First we need to check the browser support for server-sent event. So to check the browser support for Server-sent event we will check the EventSource object is true or not. If it is true then it will give alert for supporting else it will give alert for not supporting.
<script>
if(typeof(EventSource) !== "undefined") {
// Yes! Server-sent events support!
// Some code.....
} else {
// Sorry! No server-sent events support..
}
</script>
Type: | html |
Category: | Web Tutorial |
Sub Category: | HTML SSE API |
Uploaded by: | Admin |