Skip to content

Commit

Permalink
Replaced deprecated navigator.userAgent w/ .userAgentData in Chro…
Browse files Browse the repository at this point in the history
…mium browser detection methods
  • Loading branch information
adamlui committed Jun 23, 2024
1 parent 93b87a3 commit de5dc4e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions chatgpt.js
Original file line number Diff line number Diff line change
Expand Up @@ -361,9 +361,9 @@ 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'); },
isChromium: function() { return !!JSON.stringify(navigator.userAgentData?.brands)?.includes('Chromium'); },
isChrome: function() { return !!JSON.stringify(navigator.userAgentData?.brands)?.includes('Chrome'); },
isEdge: function() { return navigator.userAgent.includes('Edg'); },
isEdge: function() { return !!JSON.stringify(navigator.userAgentData?.brands)?.includes('Edge'); },
isBrave: function() { return !!JSON.stringify(navigator.userAgentData?.brands)?.includes('Brave'); },
isFirefox: function() { return navigator.userAgent.includes('Firefox'); },

Expand Down

0 comments on commit de5dc4e

Please sign in to comment.