woensdag 22 oktober 2014

Changing command line switches for Chrome on Android

While we were developing a web application, we ran into a little "snag" when a (Nexus 5 using a) Chrome browser tried to access our web application using a reversed proxy.  For some reason we received a Connection Closed after downloading the headers with some 8 kb of (corrupted) data.

When we narrowed it down that the data was compressed, we found out that Chrome enables SDCH by default, which is only supported by ... Google.  To narrow down the problem, we checked if we could access the server directly (worked via a VPN) and with different browsers (Opera and Firefox). When we used Firefox, it all worked perfectly (why? WebKit vs Gecko Engine...).

Because we actually wanted to point-out the problem, we wanted to be able to switch of the SDCH when using the Chrome browser (we used Chrome 38.0.2125.102 on Android 4.4.4). Here are the different steps we used:

  • You need to have root access on your Smartphone (we rooted a Samsung Galaxy Nexus with a Cyanogenmod);
  • You need developer access to your Smartphone;
  • You need to have adb (Android Debug Bridge) installed;
  • You need to have a good understanding of Linux/Terminal/VI;
As they say, with great power comes great responsibility. So please be careful on what you do with the root access!

Connect your device via a USB cable and start a Terminal. Connect to the device using:

$ ./adb shell

Change to root:

shell@maguro:/ $ su 

In your prompt VI a file called "/data/local/chrome-command-line" a

root@maguro:/ # vi /data/local/chrome-command-line 

Add this line (or whatever switches you may need) to this file:

--enable-sdch=0 --enable-sdch-over-https=0

Quite VI (:wq) and stop the Chrome instance running on your Android device. If you open the Chrome browser and navigate to "chrome://version", it should display the newly added switches  just below "User-Agent".

Geen opmerkingen:

Een reactie posten