Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions background.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ chrome.runtime.onConnect.addListener((port) => {

// browserByte returns either "F" for Firefox or "C" for chrome.
// Other browsers return "?".
// Firefox aliases `chrome.*` to its `browser.*` APIs, so
// `chrome.runtime.getURL` works on both; the returned scheme is what differs.
// See https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Chrome_incompatibilities
function browserByte() {
if (typeof chrome !== "undefined") {
if (typeof browser !== "undefined") {
return "F"; // Firefox supports both `chrome` and `browser`
}
return "C";
}
const url = chrome.runtime.getURL("");
if (url.startsWith("moz-extension://")) return "F";
if (url.startsWith("chrome-extension://")) return "C";
return "?";
}

Expand Down