Detecting the Provider

To detect if a user has already installed Jelli, a web application should check for the existence of a jelli object. Jelli's browser extension and mobile in-app browser will both inject a jelli object into the window of any web application the user visits, provided that site is using https://, on localhost, or is 127.0.0.1. Jelli will not inject the provider into iframes or sites using http://.

If a jelli object exists, Solana apps can interact with Jelli via the API found at window.jelli.solana. This solana object is also available at window.solana to support legacy integrations.

To detect if Jelli is installed, an application should check for an additional isJelli flag:

const isJelliInstalled = window.jelli?.solana?.isJelli;

If Jelli is not installed, we recommend you redirect your users to our website. Altogether, this may look like the following:

const getProvider = () => {
  
  // Recommended: Clean detection
  if ('jelli' in window) {
    const provider = window.jelli?.solana;
    if (provider?.isJelli) {
      return provider;
    }
  }
  
  // Fallback: Legacy detection  
  if ('solana' in window) {
    const provider = window.solana;
    if (provider?.isJelli) {
      return provider;
    }
  }
  
  // Guide users to install Jelli
  window.open('https://jel.li/', '_blank');
};

For an example of how a React application can detect Jelli, see the getProvider function in our sandbox.

Sequence Diagram

Last updated