This article describes a problem that may occur on some mobile devices, and how to resolve it.
When you try to view a web page on a mobile device, the page displays incorrectly. For example, you may see random characters or “gibberish” text. If you look at the page's source code, you see random characters inserted into the source code.
This problem occurs because some wireless providers, such as AT&T and Vodafone, use proxies that modify web content while it is in transit (these proxies are also known as “non-transparent proxies”). These modifications include code optimizations and whitespace removal to help improve performance. However, these automatic modifications can sometimes break existing code.
To resolve this problem, you must instruct proxies not to alter your site's content while it is in transit. You can do this by enabling the no-transform directive for the Cache-Control header, either directly in your application code or in an .htaccess file. The following sections demonstrate these techniques.
To set the Cache-Control header in PHP, use the header() function. The following code sample demonstrates how to do this:
<?php header("Cache-Control: no-transform"); ?>
To set the Cache-Control header in an .htaccess file, use the Header directive. The following code sample demonstrates how to do this:
<IfModule mod_headers.c> Header set Cache-Control "no-transform" </IfModule>
Subscribe to receive weekly cutting edge tips, strategies, and news you need to grow your web business.
No charge. Unsubscribe anytime.
Did you find this article helpful? Then you'll love our support. Experience the A2 Hosting difference today and get a pre-secured, pre-optimized website. Check out our web hosting plans today.
We use cookies to personalize the website for you and to analyze the use of our website. You consent to this by clicking on "I consent" or by continuing your use of this website. Further information about cookies can be found in our Privacy Policy.