Skip to content

splitio/example-javascript-browser

Repository files navigation

Examples for FME Browser SDK and JavaScript Browser SDK

Documentation Documentation

Table of Contents

Intro
Requirements
Quickstart
Further Reading

Intro

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.

Web page running Browser SDK example

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.

Requirements

To run the example, you need:

  • just a web browser
  • (optional) Python

Quickstart

This repo contains three examples:

  • index-js-sdk.html - shows how to set up the JavaScript SDK
  • index-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:

  1. Log in to Harness or create a free account.
  2. 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.
  3. Paste your SDK API key as the value of the sdkKey variable in the HTML file.
  4. Create a feature flag, initiate the FME environment, define the flag's targeting rules, and assign the flag name to the featureFlagName variable in the HTML file.
  5. 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

Further Reading

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.

About

Example Applications to demo Split JS browser SDK.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors