Intro
Requirements
Quickstart
Further Reading
These single web page examples show you how to set up the FME Browser SDK and the FME JavaScript SDK to evaluate an FME feature flag and send an event.
The Browser SDK is optimized for web browsers and built on top of the JavaScript SDK core modules. To compare between the SDK versions, see also the JavaScript to Browser SDK Migration Guide.
To run the example, you need:
- just a web browser
- (optional) Python
This repo contains three examples:
index-js-sdk.html- shows how to set up the JavaScript SDKindex-js-browser-sdk.html- shows how to set up the Browser SDK (similar to JavaScript SDK, but optimized for web browsers)index-js-browser-sdk-full.html- shows how to set up the Browser SDK, with logging
To run the SDK on the web page:
- Log in to Harness or create a free account.
- Navigate to Feature Management & Experimentation > FME Settings > Projects > View > SDK API Keys and copy a client-side SDK API key for one of your FME environments.
- Paste your SDK API key as the value of the
sdkKeyvariable in the HTML file. - Create a feature flag, initiate the FME environment, define the flag's targeting rules, and assign the flag name to the
featureFlagNamevariable in the HTML file. - Open the HTML file in your browser and see the treatment for the feature flag.
You can also serve the HTML files using Python as a lightweight web server, by running python3 -m http.server in a command prompt from your local example-javascript-browser folder. Then you can navigate to the pages on localhost, for example:
http://localhost:8000/index-js-browser-sdk.html
See the FME JavaScript SDK and the FME Browser SDK docs to learn about configuration options, optimizations, and event tracking.
For more information about feature flags, see our Feature Management documentation.
Harness is a software delivery platform that delivers intelligent AI automation, so your team ships code faster, safer, and smarter.
