Skip to content

Commit 9e0c23b

Browse files
authored
Add files via upload
1 parent 6935faf commit 9e0c23b

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

js/not-chromium-snippet.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//Small snippet to warn users to use a Chromium‑based browser
2+
function notChromium() {
3+
const ua = navigator.userAgent || '';
4+
const nonChromiumUA = /\b(Firefox|FxiOS|Seamonkey|Gecko\/|PaleMoon|Waterfox)\b/i.test(ua);
5+
const webkitOnly = /\bAppleWebKit\/(?!.*Chrome|.*CriOS|.*Chromium)/i.test(ua) && !/Chrom(e|ium|iOS)|CriOS|Edg|OPR|Brave/i.test(ua);
6+
7+
return (nonChromiumUA || webkitOnly);
8+
}
9+
10+
if (notChromium()) {
11+
const contentElement = document.getElementById('content');
12+
const warningElement = document.createElement('span');
13+
warningElement.className = 'not-chromium-warning';
14+
warningElement.textContent = 'Warning: This editor works best in Chromium-based browsers (e.g., Chrome, Edge, Opera).';
15+
contentElement.insertBefore(warningElement, contentElement.firstChild);
16+
}

0 commit comments

Comments
 (0)