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 }