Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Here is the list of props used by the component.
|Property |Type |Default |Description |
|-----------|-------|----------|--------------|
|once |Bool |true |If ```true```, function contained in children prop will be call only once. If ```false```, it will be called on each render. Default ```true``` due to performance reasons |
|children |Object { browserName: function(browserName){ return node; } } | |An object containing functions to handle different browsers. Properties would be called like browsers: ```chrome```, ```firefox```, ```ie```, ```edge```, ```safari```, ```opera```, ```blink```, ```googlebot``` and ```default```. If specified, the component will use the function under the property with the name of the browser, otherwise, it will use ```default```. Each function take the browser name as parameter and must return a node |
|children |Object { browserName: function(browserName){ return node; } } | |An object containing functions to handle different browsers. Properties would be called like browsers: ```chrome```, ```firefox```, ```ie```, ```edge```, ```safari```, ```opera```, ```blink```, ```googlebot```, ```samsung``` and ```default```. If specified, the component will use the function under the property with the name of the browser, otherwise, it will use ```default```. Each function take the browser name as parameter and must return a node |


### Determining the OS
Expand Down
3 changes: 3 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export default class BrowserDetection extends React.Component {

const isAndroid = navigator.userAgent.toLowerCase().indexOf('android') !== -1;
const isGoogleBot = navigator.userAgent.toLowerCase().indexOf('googlebot') !== -1;
const isSamsungBrowser = navigator.userAgent.toLowerCase().indexOf('samsungbrowser') !== -1;
// eslint-disable-next-line
const isIE = /*@cc_on!@*/false || !!document.documentMode;
const isEdge = !(isIE) && !!window.StyleMedia;
Expand Down Expand Up @@ -46,6 +47,8 @@ export default class BrowserDetection extends React.Component {
browser = 'blink';
} else if (isGoogleBot) {
browser = 'googlebot';
} else if (isSamsungBrowser) {
browser = 'samsung';
} else {
browser = 'unknown';
}
Expand Down