[TIMOB-23553] Android: Ti.userAgent shouldn't be read-only
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2016-08-29T07:26:29.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Android |
Labels | parity |
Reporter | Christopher Williams |
Assignee | Christopher Williams |
Created | 2016-06-23T22:10:57.000+0000 |
Updated | 2017-11-27T19:32:09.000+0000 |
Description
According to our docs, Ti.userAgent should be a property we can overwrite and should have a setter:
http://docs.appcelerator.com/platform/latest/#!/api/Titanium-property-userAgent
On Android that is not the case.
it('userAgent', function () {
should(Ti.userAgent).be.a.String;
var save = Ti.userAgent;
Ti.userAgent = 'Titanium_Mocha_Test';
should(Ti.userAgent).be.eql('Titanium_Mocha_Test');
Ti.userAgent = save;
should(Ti.userAgent).be.eql(save);
});
It looks like the Ti.userAgent for Android is read only, as it is the equivalent of the Android System default user agent. The only useragent that you wish to set would be in webView, or the request header of HttpClient.
Closing ticket as invalid.
I think you could also set the user agent on imageviews, and also in third party modules. You set the useragent globally, and all modules will be able to use (and modify) the shared value. In my use case, we are using middleware on an api to filter out all useragents except ours. We also append version numbers in case we want to enforce a client version.