Showing posts with label inlining. Show all posts
Showing posts with label inlining. Show all posts

Tuesday, 20 July 2010

Mobile Proxy Cache content modification by O2

If you connect to the web on a mobile Safari device such as an iPhone or iPad using 3G over O2's network in the UK, then you may not realise that what you are seeing has been modified by O2 between the web site and your phone. If you are the author of a web site and find that some customers are not seeing what they should you may be frustrated to discover that O2 have changed the source code before it gets to your customer and that you have little way of finding out what they have done.

I'm sure O2 is doing this in order to speed up the service and reduce network load, but unfortunately their modifications are not without consequences, as I discovered trying to host a site designed specifically to work well on an iPad.

Image reduction

The most widely recognised change they make is to reduce the resolution of image files.  This has caused some complaint recently from iPad owners who have a large enough display to easily spot the different in quality that results when, for example, browsing photographs on Flickr.

However, they also do quite a lot more.

HTML parsing, inlining and compression

O2 takes HTML files, inlines some of the included JavaScript and CSS files and removes some comments and carriage returns:

  • No escaping of > and < symbols takes place when the code is embedded. In some circumstances, depending on the DOCTYPE specified, this can generate errors and effectively render the web site useless.
  • If you are using a third party JavaScript code library which requires you to maintain their copyright message on their source code, or you simply want your own copyright message to always appear in your source code, you might be a little concerned to discover that O2 removes the copyright message as it passes through their network. Not sure what the legal ramifications of this are!
  • Inlining appears to be carried out in a non-deterministic way (possibly based on load times at O2's proxy server). Consequently, errors can be generated that appear to the customer to be occurring randomly.

On top of this the processes carried out by O2 will be increasing the latency of delivering the page to the user and completely messing up any optimisations put in place by the web site designer. If, for example, you place all the JavaScript at the end so that the page can be rendered on screen before everything loads, you are now having to wait, not just for everything to load, but also for O2 to assemble it all into one inlined file.

Where this micro-optimisation really starts to hit is where the user visits multiple pages of one web site which all load in common libraries like jQuery or Google Analytics. Instead of your local mobile browser caching these resources, O2 has embedded them, so they have to be embedded uniquely into every web page and sent to the user in their entirety. It's called a micro-optimisation because it optimises in the small individual case but in the bigger picture it actually slows things down massively and increases your bandwidth usage. The usage that you may well be paying for.

What are you paying for?

So, if you are an O2 customer, how can it be that O2 can modify the web content without telling you? How can they sell a service and secretly make changes to what you get? It may be well intentioned, but it is nevertheless a completely hidden modification that even O2 customer support are unaware of.

How can any web site designer try to support their web site if customers are actually receiving something different that O2 have modified on the way in a way that they don't tell you about?

Legally, can O2 strip copyright messages from code and merge code which may, by the nature of their licenses be required to be distributed separately with copyright messages left intact.

If you are an O2 customer or a web designer, I suggest you contact O2 and make them aware that this is a serious issue.

 
Google Analytics Alternative