Charles
  • Introduction
    • 👋Welcome
  • Getting started
    • Quickstart guide
  • Opening actions
    • Popup, side bar and modal options
    • Trigger the extension with a floating button
    • Open the extension automatically on specific URLs
  • Key features
    • Features overview
    • Open website on install / uninstall
    • Get tab info
    • Get text selected by user
    • Get element text
    • Get element HTML
    • Set element inner text
    • Set element inner HTML
    • Open URL in sidebar modal
    • Open URL in fullscreen modal
    • Copy text to clipboard
    • Populate an input field
    • Simulate mouse click on an element
    • Capture screenshot
    • Open URL in new tab
    • Show native alert
    • Set an extension badge color and text
    • Change extension icon
    • Close extension
    • Save to Chrome storage
    • Injecting custom javascript
  • Extending Charles
    • Extending Charles with your own Javascript
  • Publishing to the Chrome Webstore
    • Prepare extension for submission
    • Registering as a Chrome Webstore developer
    • Publishing your extension
  • FAQ
    • Common questions
  • Troubleshooting
    • Charles Data Elements do not receive any values
    • Cannot log in (cookie issues)
    • Support
Powered by GitBook
On this page
  1. Key features

Open website on install / uninstall

To customise the behavior of your Chrome extension during installation and uninstallation, you can comment, uncomment, or adjust lines 57 and line 62 in background.js.

Commented lines will be ignored. Line 57 handle the actions upon installation, while line 62 manages the actions upon uninstallation.

Action on install

// Open a page on install. comment / uncomment the lines below and replace the URL with the URL you want to open on install
chrome.runtime.onInstalled.addListener((details) => {
    if (details.reason === chrome.runtime.OnInstalledReason.INSTALL) {
        chrome.tabs.create({ url: "https://buildwithcharles.io/welcome" });
    }
});

Action on uninstall

// // open a page on uninstall. uncomment the line below and replace the URL with the URL you want to open on uninstall
chrome.runtime.setUninstallURL("https://buildwithcharles.io/welcome");

PreviousFeatures overviewNextGet tab info

Last updated 5 months ago