-Поиск по дневнику

Поиск сообщений в rss_planet_mozilla

 -Подписка по e-mail

 

 -Постоянные читатели

 -Статистика

Статистика LiveInternet.ru: показано количество хитов и посетителей
Создан: 19.06.2007
Записей:
Комментариев:
Написано: 7


Karl Dubost: How to deactivate UA override on Firefox OS

Понедельник, 27 Октября 2014 г. 13:39 + в цитатник

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 (where something 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.

Otsukare.

http://www.otsukare.info/2014/10/27/ua-override-off


 

Добавить комментарий:
Текст комментария: смайлики

Проверка орфографии: (найти ошибки)

Прикрепить картинку:

 Переводить URL в ссылку
 Подписаться на комментарии
 Подписать картинку