Horje
How to Check Server-Sent Events Support | HTML SSE API Code
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



Read Full::
HTML SSE API Code
Category:
HTML Code
Sub Category:
HTML SSE API Code
Uploaded:
1 month ago
Uploaded by:
Admin
Views:
1

Related Articles
What is HTML SSE API HTML SSE API Code
How to add Server-Sent Events - One Way Messaging HTML SSE API Code
What types of browsers will support HTML SSE API HTML SSE API Code
How to Receive Server-Sent Event Notifications HTML SSE API Code
How to Check Server-Sent Events Support HTML SSE API Code
What is Server-Side Code Example HTML SSE API Code
What are The EventSource Object HTML SSE API Code

Single Articles
Example of Browsing Support check HTML SSE API

Share on: