Vodacom optimising HTML being served?

jamiebarrow

Member
Joined
Sep 28, 2010
Messages
16
Reaction score
0
Hi all,

I'm developing an app using knockout.js and decided to use the HTML comments for doing the bindings, e.g.

<!-- ko with: selectedItem -->
<div>Selected: <span data-bind="text: name"></span></div>
<!-- /ko -->

The app is meant to be accessible from mobile phones, and this works fine if I test via WIFI on my Samsung Galaxy S3 inside Google Chrome, but when I try and access it with WIFI turned off, and go through mobile data, then for some reason the markup is compacted and optimised with HTML comments either removed or compacted, e.g.

<!--//--><div>Selected:<span data-bind="text: name"></span></div>

The server that is serving the page doesn't do any optimisations like this and so I'm assuming that there must be something on the Vodacom network that is stripping this stuff out. Can anyone confirm if my suspicion is correct?

Unfortunately I can't disclose the URL I'm testing at the moment as it's not officially live and is going through a testing phase.

Thanks,

James
 
I wouldn't be surprised. HTML Comments adds to the size of the web page. It's for mobile, why would you want your mobile device to download more than it needs to?

Proxy's for mobile (like Vodacom) would most definitely optimize by stripping away comments, making the data transfer as small and as fast as possible.
 
why would you want your mobile device to download more than it needs to?

Completely agree with you, and in hindsight, shouldn't have used the HTML form of bindings that knockout supports... in this case, though, it has been written so that it does actually need those comments :) I wonder if the same thing happens with websites being loaded on Internet Explorer when going via a 3G modem? That could cause lots of sites to break if they strip out conditional comments too.

In my case, it's probably easy enough to replace them with <div> elements with the bindings on, or possibly move the binding into a data-bind attribute on the next sibling/child element, so hopefully not too much of a pain...
 
Well I've been doing "this" for 13 years now and have never resorted to comments for any kind of programming (server or client side)

If I were you I'd rather stick with div elements and their bindings.

FYI, a lot of websites won't break, because it's only you who rely on HTML comments for things to work ;), but yes, IE through a 3G device would break because the proxy is on their network, not your phone or your PC
 
because it's only you who rely on HTML comments for things to work ;)

Well, I wouldn't say it's only me, nor me and Steve Sanderson only, (e.g. view source of this page and you'll even see the common method of hiding JavaScript code using a comment block inside a script tag for older browsers that didn't support JavaScript; could provide a lot, LOT, more examples where comments are used, but won't, I'm sure you've probably come across those in those 13 years ;)).

... but yeah, first time in my 6 years of doing "this" professionally that I've relied on comments to provide functionality :D Hindsight is 20/20 :)
 
a conditional for different versions of IE is completely different, thats mostly just fallback
 
Top
Sign up to the MyBroadband newsletter
X