Skip to content
This repository was archived by the owner on Nov 15, 2017. It is now read-only.

Commit f85d038

Browse files
committed
this fixes #261
1 parent a8f24c5 commit f85d038

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

js/contentscript-uaspoof.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@
2727

2828
/******************************************************************************/
2929

30+
// If you play with this code, mind:
31+
// https://github.com/gorhill/httpswitchboard/issues/261
32+
// https://github.com/gorhill/httpswitchboard/issues/252
33+
3034
var navigatorSpoofer = " \
3135
;(function() { \
3236
try { \
@@ -50,8 +54,10 @@ var navigatorSpoofer = " \
5054
spoofedNavigator[k] = realNavigator[k]; \
5155
} \
5256
} \
53-
spoofedNavigator.appVersion = spoofedUserAgent; \
5457
spoofedNavigator.userAgent = spoofedUserAgent; \
58+
var pos = spoofedUserAgent.indexOf('/'); \
59+
spoofedNavigator.appName = pos < 0 ? '' : spoofedUserAgent.slice(0, pos); \
60+
spoofedNavigator.appVersion = pos < 0 ? spoofedUserAgent : spoofedUserAgent.slice(pos + 1); \
5561
navigator = window.navigator = spoofedNavigator; \
5662
} catch (e) { \
5763
} \

0 commit comments

Comments
 (0)