0 votes
in JavaScript by
How do you check browser support for server-sent events in Javascript?

1 Answer

0 votes
by

You can perform browser support for server-sent events before using it as below,

if (typeof EventSource !== "undefined") {
  // Server-sent events supported. Let's have some code here!
} else {
  // No server-sent events supported
}
...