Is there an alternative Network Information API (navigator.connection) that will work for Safari and Firefox?

I’m currently trying to obtain network connection details using the navigator.connection API upon clicking a button. However, I’ve encountered an issue where this API does not work on Safari and Firefox browsers.

Can you provide an alternative solution or approach to retrieve network connection details for these browsers?

getConnectionDetails() { 
  if ('connection' in navigator) { 
    var con = navigator.connection;
    if (con) {
      const downlink = con.downlink; // Network download speed in Mbps
      const effectiveType = con.effectiveType;
      const rtt = con.rtt; // Round-trip time in milliseconds

      const start_connection_details = {
        downlink: downlink,
        effectiveType: effectiveType,
        rtt: rtt
      };

      return start_connection_details;
    } else {
      console.log("navigator.connection is null.");
      return {};
    }
  } else {
    console.log("navigator.connection is not supported on this browser.");
    return {};
  }
}

I am expecting to get at least the download speed for Safari and Firefox browsers. However, the current result for these browsers is:
navigator.connection is not supported on this browser.