The browser detection system automatically identifies the user’s browser and dynamically updates extension store links throughout the anchored.site website. This ensures users are directed to the correct extension store for their browser.
js/browser-detection.js
The browser detection module is a self-contained JavaScript module that:
Browser | Detection Method | Store URL | Status |
---|---|---|---|
Chrome | Chrome in UA + Google vendor |
Chrome Web Store | ✅ Available |
Firefox | Firefox in UA |
Firefox Add-ons | ✅ Available |
Edge | Edg/ or Edge/ in UA |
Edge Add-ons | ✅ Available |
Safari | Safari in UA + Apple vendor |
N/A | ⏳ Coming Soon |
Opera | OPR or Opera in UA |
Chrome Web Store | ✅ Available |
Brave | Falls back to Chrome | Chrome Web Store | ✅ Available |
The module uses a priority-based detection system:
The module is integrated into pages via the Jekyll front matter:
---
scripts:
- config.js
- js/browser-detection.js # Add this line
- js/app.js
# ... other scripts
---
The module automatically initializes on page load and updates all links with the class chrome-store-link
or primary buttons linking to the Chrome Web Store.
Any link with the class chrome-store-link
will be automatically updated:
<a href="https://chromewebstore.google.com/..."
class="chrome-store-link"
target="_blank">Get Extension</a>
You can also use the module programmatically:
// Get detected browser info
const browser = BrowserDetection.detectBrowser();
console.log(browser.name); // 'chrome', 'firefox', 'edge', etc.
// Get appropriate store URL
const storeUrl = BrowserDetection.getStoreUrl();
// Get browser-specific messaging
const message = BrowserDetection.getBrowserMessage();
console.log(message.title); // "Get Anchored for Firefox"
https://chromewebstore.google.com/detail/anchored-%E2%80%93-notes-highligh/llkmfidpbpfgdgjlohgpomdjckcfkllg
https://addons.mozilla.org/firefox/addon/anchored-notes/
Note: Update this URL once the Firefox extension is published.
https://microsoftedge.microsoft.com/addons/detail/anchored-notes/
Note: Update this URL once the Edge extension is published.
Not yet available. Shows “Coming Soon” message to users.
A comprehensive test page is available at test-browser-detection.html
which includes:
To test browser detection:
test-browser-detection.html
in different browsersYou can test different browsers using Chrome DevTools:
When Firefox or Edge extensions are published, update the URLs in js/browser-detection.js
:
STORE_URLS: {
chrome: 'https://chromewebstore.google.com/...',
firefox: 'YOUR_FIREFOX_ADDON_URL_HERE',
edge: 'YOUR_EDGE_ADDON_URL_HERE',
safari: null
}
To add support for a new browser:
detectBrowser()
methodSTORE_URLS
objectgetBrowserMessage()
methodThe detection module itself works in all modern browsers:
navigator.userAgent
and navigator.vendor
js/browser-detection.js
is loaded before DOM readychrome-store-link
classnavigator.userAgent
detectBrowser()
methodjs/browser-detection.js
- Main detection moduleindex.html
- Homepage with browser detectionhelp.html
- Help page with browser detectiontest-browser-detection.html
- Test suitedocs/BROWSER_DETECTION.md
- This documentationThis implementation satisfies the following requirements from the Firefox Extension Migration spec: