Skip to content

Commit

Permalink
Added chatgpt.browser.isChrome()
Browse files Browse the repository at this point in the history
  • Loading branch information
adamlui committed Jun 23, 2024
1 parent f999117 commit f5e4374
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions chatgpt.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ const chatgpt = { // eslint-disable-line no-redeclare
isLightMode: function() { return window.matchMedia?.('(prefers-color-scheme: light)')?.matches; },
isDarkMode: function() { return window.matchMedia?.('(prefers-color-scheme: dark)')?.matches; },
isChromium: function() { return navigator.userAgent.includes('Chrome'); },
isChrome: function() { return !!JSON.stringify(navigator.userAgentData?.brands)?.includes('Chrome'); },
isEdge: function() { return navigator.userAgent.includes('Edg'); },
isFirefox: function() { return navigator.userAgent.includes('Firefox'); },

Expand Down
13 changes: 13 additions & 0 deletions docs/USERGUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
- [get](#get)
- [getUserLanguage](#getuserlanguage)
- [isChromium](#ischromium)
- [isChrome](#ischrome)
- [isEdge](#isedge)
- [isFirefox](#isfirefox)
- [isFullScreen](#isfullscreen)
Expand Down Expand Up @@ -1322,6 +1323,18 @@ if (chatgpt.browser.isChromium()) {
}
```

### isChrome

Returns a boolean value. `true` if the browser is Chrome and `false` otherwise.

Example code:

```js
if (chatgpt.browser.isChrome()) {
// Do something
}
```

### isEdge

Returns a boolean value. `true` if the browser is Edge and `false` otherwise.
Expand Down

0 comments on commit f5e4374

Please sign in to comment.