Horje
How to Check Server-Sent Events Support

In the tryit example above there were some extra lines of code to check browser support for server-sent events:


Example of Browsing Support check HTML SSE API

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.

index.html
Example: HTML
<script>
if(typeof(EventSource) !== "undefined") {
  // Yes! Server-sent events support!
  // Some code.....
} else {
  // Sorry! No server-sent events support..
} 
</script>

Output should be:

Example of Browsing Support check HTML SSE API
Reffered: https://www.javatpoint.com/html-server-sent-event





Related Articles
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

Single Articles
Example of Browsing Support check HTML SSE APIHTML SSE API

Read Full:
HTML SSE API
Category:
Web Tutorial
Sub Category:
HTML SSE API
Uploaded:
10 months ago
Uploaded by:
Admin
Views:
25



Share on: