Requirements and polyfills
Read time: 1 minute
Last edited: Feb 3, 2020
Three features that are used by the LaunchDarkly SDK that may not be available on every browser are
For all of these features, there are two ways you can provide the polyfill script.
One is to load it directly from a CDN that hosts the package, with a
<script> tag within the
<head> element of your page. Note that you must put the
<script> tag for the polyfill before any scripts that make use of the LaunchDarkly SDK.
1<script src="[URL of the polyfill script]"></script>
If you are using a package manager such as NPM or Yarn, and using
require() to load modules at runtime, you would first add the polyfill package to your project:
1npm install firstname.lastname@example.org
Then, make sure that you
require the polyfill module prior to initializing the LaunchDarkly client:
You only need to use one of these methods—CDN or package manager—not both.
1<!-- loading polyfill from CDN -->2<script src="https://email@example.com/dist/es6-promise.auto.min.js"></script>
The SDK uses
EventSource to provide a live streaming connection to LaunchDarkly, if you have enabled streaming (by using the
streaming property or the
setStreaming method, or by subscribing to
change events). If you never enable streaming, you do not need
It is widely available in browsers, except for Internet Explorer and Microsoft Edge. If you wish to support these, and you need streaming support, you can install a polyfill such as event-source-polyfill.
1<!-- loading polyfill from CDN -->2<script src="https://firstname.lastname@example.org/src/eventsource.min.js"></script>
The SDK uses
querySelectorAll to support click events for A/B testing. If you never use click goals, you do not need
It is widely available in browsers, except in old versions of Internet Explorer. If you wish to support these, and you need A/B testing support, you can install a polyfill such as polyfill-queryselector.
1<!-- loading polyfill from CDN -->2<script src="https://email@example.com/querySelector.js"></script>