Some Web sites do not send the right version of the content to Firefox OS. Some ill-defined server side and client side scripting do not detect Firefox OS as a mobile device and they send the desktop content instead. To fix that, we sometimes define UA override for certain sites.
It may improve the life of users but as damaging consequences when it's time for Web developers to test the site they are working on. The device is downloading the list on the server side at a regular pace. Luckily enough, you can deactivate it through preferences.
Firefox UA Override Preferences
There are two places in Firefox OS where you may store preferences:
/system/b2g/defaults/pref/user.js
/data/b2g/mozilla/something.default/prefs.js
(wheresomething
is a unique id)
To change the UA override preferences, you need to set useragent.updates.enabled
to true
(default) for enabling and to false
for disabling. If you put in /system/
, each time you update the system, the file and its preferences will be crushed and replace by the update. On the other if you put it in /data/
, it will be kept with all the data of your profiles.
On the command line, using adb, you can manipulate the preferences:
# Prepare
set -x
adb shell mount -o rw,remount /system
# Local copy of the preferences
adb pull /system/b2g/defaults/pref/user.js /tmp/user.js
# Keep a local copy of the correct file.
cp /tmp/user.js /tmp/user.js.tmp
# Let's check if the preference is set and with which value
grep useragent.updates.enabled /tmp/user.js
# If not set, let's add it
echo 'pref("general.useragent.updates.enabled", true);' >> /tmp/user.js.tmp
# Push the new preferences to Firefox OS
adb push /tmp/user.js.tmp /system/b2g/defaults/pref/user.js
adb shell mount -o ro,remount /system
# Restart
adb shell stop b2g && adb shell start b2g
We created a script to help for this. If you find bugs, do not hesitate to tell us.
Clarification Notes
Prior to Firefox OS 1.2, we were having the list of UA override on the device itself. The file was updated with system updates. But we noticed that some carriers were not sending the updates as much as we wished. It is an issue, because some sites may have been fixed in the mean time and we might trigger the wrong information. So we decided to push the list of the server side starting with Firefox OS 1.2. The users can then receive an always updated list of UA override. Thanks to André Jaenisch for the question.
Otsukare.