Files: 0e149ed1e49805506189850e99b11ef2da51a5c9 / 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