In the tryit example above there were some extra lines of code to check browser support for server-sent events: |
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.
Example:
HTML
<script>
if(typeof(EventSource) !== "undefined") {
// Yes! Server-sent events support!
// Some code.....
} else {
// Sorry! No server-sent events support..
}
</script>
Reffered: https://www.javatpoint.com/html-server-sent-event
What is HTML SSE API | HTML SSE API |
How to add Server-Sent Events - One Way Messaging | HTML SSE API |
What types of browsers will support HTML SSE API | HTML SSE API |
How to Receive Server-Sent Event Notifications | HTML SSE API |
How to Check Server-Sent Events Support | HTML SSE API |
What is Server-Side Code Example | HTML SSE API |
What are The EventSource Object | HTML SSE API |
Example of Browsing Support check HTML SSE API | HTML SSE API |
Read Full: | HTML SSE API |
Category: | Web Tutorial |
Sub Category: | HTML SSE API |
Uploaded: | 10 months ago |
Uploaded by: | Admin |
Views: | 25 |