# Supported environments for the Firebase JavaScript SDK

## Supported environments
The Firebase JavaScript SDK is officially supported in the following environments.

### Browsers

| Firebase product | Edge | Firefox | Chrome | iOS Safari | Safari |
| --- | --- | --- | --- | --- | --- |
| **Firebase AI Logic** 1 |  |  |  |  |  |
| **Analytics** |  |  |  |  |  |
| **App Check** |  |  |  |  |  |
| **Authentication** |  |  |  |  |  |
| **Cloud Firestore** | (except\npersistence) |  |  | (except\npersistence\nif iOS < 10) |  |
| **Cloud Functions** |  |  |  |  |  |
| **Cloud Messaging** | (Edge 17+, except mobile) |  |  |  |  |
| **Cloud Storage** |  |  |  |  |  |
| **Firebase installations** |  |  |  |  |  |
| **Performance Monitoring** |  |  |  |  |  |
| **Realtime Database** |  |  |  |  |  |
| **Remote Config** |  |  |  |  |  |
| **SQL Connect** |  |  |  |  |  |

**1** _Firebase AI Logic was formerly called_
_"Vertex AI in Firebase"._

### Other environments

| Firebase product | React Native | Node.js (18+) | Chrome\nExtensions | Cordova |
| --- | --- | --- | --- | --- |
| **Firebase AI Logic** 1 |  |  |  |  |
| **App Check** | (using a [custom provider](/content/docs/app-check/android/custom-provider/index.html) to do native device attestation) | (using a [custom provider](/content/docs/app-check/custom-provider/index.html)) |  |  |
| **Analytics** |  |  |  |  |
| **Authentication** | (see [Note](/content/docs/web/environments-js-sdk#auth-note/index.html)) | (see [Note](/content/docs/web/environments-js-sdk#auth-note/index.html)) | (see [Note](/content/docs/web/environments-js-sdk#auth-note/index.html)) | (see [Note](/content/docs/web/environments-js-sdk#auth-note/index.html)) |
| **Cloud Firestore** | (except\npersistence) | (except\npersistence) |  |  |
| **Cloud Functions** |  |  |  |  |
| **Cloud Messaging** |  |  |  |  |
| **Cloud Storage** | (except\nuploads) |  |  |  |
| **Firebase installations** |  |  |  |  |
| **Performance Monitoring** |  |  |  |  |
| **Realtime Database** |  |  |  |  |
| **Remote Config** |  |  |  |  |
| **SQL Connect** |  |  |  |  |

**1** _Firebase AI Logic was formerly called_
_"Vertex AI in Firebase"._

## Polyfills
The Firebase JavaScript SDK is built on the latest standards of the web platform. Some older browsers and JavaScript environments do not support all the features required by Firebase. If you must support these browsers/environments, then you need to load polyfills accordingly.

The sections below identify most of the polyfills you might need.

### Required polyfills

| **Environments** | **Polyfills** |
| --- | --- |
| Safari 7 & 8 & 9 | [ES Stable](/content/docs/web/environments-js-sdk#suggested-polyfills/index.html) |
| Node < 10 | [ES Stable](/content/docs/web/environments-js-sdk#suggested-polyfills/index.html) |

### Optional polyfills

| **Environments** | **Polyfills** | **Firebase products** |
| --- | --- | --- |
| - Safari < 10.1\n- iOS < 10.3 | [fetch](/content/docs/web/environments-js-sdk#suggested-polyfills/index.html) | - Authentication\n- Cloud Firestore\n- Cloud Functions\n- Performance Monitoring |
| - Node < 18 | [fetch](/content/docs/web/environments-js-sdk#suggested-polyfills/index.html) | - Authentication\n- Cloud Firestore\n- Cloud Functions\n- Cloud Storage |
| - React Native and Expo | [base-64](/content/docs/web/environments-js-sdk#suggested-polyfills/index.html) | - Cloud Storage |

### Suggested polyfills

| **Polyfills** | **License** |
| --- | --- |
| [ES\n Stable](https://github.com/zloirock/core-js/tree/master/packages/core-js/stable) | MIT |
| [fetch](https://github.com/lquixada/cross-fetch) - `cross-fetch` - best for older browsers | MIT |
| [fetch](https://github.com/nodejs/undici) - `undici` - best for Node.js | MIT |
| [base-64](/content/docs/web/environments-js-sdk#react-native-polyfill-setup/index.html) | MIT |

### Required Polyfill Setup for React Native and Expo
For React Native and Expo if you are uploading a base-64 encoded string, you need to do the following:

Install [base-64](https://github.com/mathiasbynens/base64) from npm:

```
npm install base-64
```

Import `decode` from `base-64` and attach it to the global scope as `atob` so Cloud Storage can access it.

```
import { decode } from 'base-64';

if(typeof atob === 'undefined') {
  global.atob = decode;
}
```

## Add polyfills in your application
### **Option 1**: _(Recommended)_ Use bundler integrated with Babel
If you're using a bundler, integrate with [Babel](https://babeljs.io/) and [@babel/preset-env](https://babeljs.io/docs/en/babel-preset-env) to get polyfills.

Use Babel's interactive [setup guide](https://babeljs.io/setup.html) to learn how to integrate Babel with your bundler.

With Babel, you don't need to worry about the exact polyfills to include. Instead, you specify the minimal browser environments that you need to support. Babel then adds the necessary polyfills for you. Babel ensures that your requirements for browser support are always met, even if Firebase or your own code starts using new ES features.

[@babel/preset-env](https://babeljs.io/docs/en/babel-preset-env) has detailed information about the available configuration options for specifying environment targets (option `targets`) and adding polyfills (option `useBuiltIns`).

### **Option 2**: _(Not Recommended)_ Add polyfills manually
You can add polyfills manually using your favorite polyfill libraries (for example, [`core-js`](https://github.com/zloirock/core-js/tree/v3)).

```
import 'core-js/stable'
import 'cross-fetch/polyfill';
```

`core-js` also provides an [all-in-one polyfill file](https://unpkg.com/core-js-bundle@3.0.1/minified.js) that you can directly include in the HTML page.

This option can be a convenient way for managing polyfills if you don't use Babel. However, **we don't recommend this all-in-one option for production** **apps** as it will likely include unnecessary polyfills, which increases the page weight and hence the page load time.

## Licensing Information
Except as otherwise noted, the content of this page is licensed under the [Creative Commons Attribution 4.0 License](https://creativecommons.org/licenses/by/4.0/), and code samples are licensed under the [Apache 2.0 License](https://www.apache.org/licenses/LICENSE-2.0). For details, see the [Google Developers Site Policies](https://developers.google.com/site-policies). Java is a registered trademark of Oracle and/or its affiliates.
