From 7fb11ba912246af82593a30eaef64e05731b4a12 Mon Sep 17 00:00:00 2001 From: Danny Coates Date: Tue, 16 Jan 2018 13:21:26 -0800 Subject: [PATCH] added 'browser' to survey url. fixes #657 --- app/templates/header.js | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/app/templates/header.js b/app/templates/header.js index b1c38a6e..3c0e1bb0 100644 --- a/app/templates/header.js +++ b/app/templates/header.js @@ -12,6 +12,31 @@ const assets = require('../../common/assets'); */ const version = require('../../package.json').version || 'VERSION'; +function browserName() { + try { + if (/firefox/i.test(navigator.userAgent)) { + return 'firefox'; + } + if (/edge/i.test(navigator.userAgent)) { + return 'edge'; + } + if (/trident/i.test(navigator.userAgent)) { + return 'ie'; + } + if (/chrome/i.test(navigator.userAgent)) { + return 'chrome'; + } + if (/safari/i.test(navigator.userAgent)) { + return 'safari'; + } + return 'other'; + } catch (e) { + return 'unknown'; + } +} + +const browser = browserName(); + module.exports = function(state) { return html`
-