-
Book Overview & Buying
-
Table Of Contents
RESS Essentials
In this approach, we don't use any external libraries. We don't test for browser capabilities as in the first example; we are only concerned with the screen width. The purpose here is to create something simple and extendable at the same time. The PHP code for the two main classes have less than 100 lines, and a test page set to the browser for reload has less than 1.5 KB in a non-minified state with all the JavaScript included. You can use the code from this example as a starting point for building your own tests best suited to your situation, without worrying about third-party licenses or library updates. I tried to make it as simple and safe as possible. In case of any problems, the result of the check will change to the basic version and a 120 px screen width.
The following figure shows the program flow; you can see that the logic is very similar to that of the Detector. This simplified version doesn't store UA profiles in the local cache.

The application...
Change the font size
Change margin width
Change background colour