Skip to main content
100%

WebExtension main JS to add current URL to PIM (PmWiki POST API)

✓ Published0🌍 Public
UUtopiah
Last edited Mar 13, 2021
Created on Mar 13, 2021

This example shows a browser extension that saves the current tab’s URL into a PmWiki page via a POST API. It uses the WebExtension `browser.browserAction`, `browser.tabs`, and `browser.windows` APIs to track the active tab and trigger the action. The code fetches the existing page content from the PmWiki source URL, appends the current URL to that text, and sends it back with `fetch` using a `POST` request and `application/x-www-form-urlencoded` headers. It also filters supported protocols to only allow HTTP and HTTPS links.

AI-generated description

Similar vizzes