Files: 83be8b8f43a8989f425e4948524233cb63983146 / utils / request.js
407 bytesRaw
1 | /** |
2 | * @function getUserAgent |
3 | * @description Returns the user agent of the request or from the navigator |
4 | * @param {Object} request Http request |
5 | * @return {String} User Agent |
6 | */ |
7 | export const getUserAgent = request => { |
8 | if (request) { |
9 | return request.headers['user-agent']; |
10 | } else if (typeof window !== 'undefined' && window.navigator) { |
11 | return window.navigator.userAgent; |
12 | } |
13 | |
14 | return ''; |
15 | }; |
Built with git-ssb-web