The Wireless Universal Resource File

12.6 How can I tell iMode browsers from other browsers?

Just like with WML browsers, you will need to know which browser is being used to display your Compact HTML content to keep compatibility as high as possible. The procedure for WAP devices is explained here.

This detection of browsers has to be done on the server side, and the following very simple PHP code will simply show you some details about the browser. From this you will be able to tell if the iMode browser can display HTML 1.0 or HTML 2.0 with iMode extensions, and so on.

  <?
    $browserinfo = split("/",$HTTP_USER_AGENT,5);               // Split the USER_AGENT string into 5 parts
    echo("This is a ".$browserinfo[0]." browser\n");            // Usually says "DoCoMo"
    echo("It supports HTML ".$browserinfo[1]."\n");             // Contains the supported HTTP version number
    echo("The browser model is ".$browserinfo[2]."\n");         // Contains the browser model
    echo("The cache size is currently ".$browserinfo[3]."\n");  // Contains the current cache size in Kilobytes
    echo("Remaining information: ".$browserinfo[4]."\n");       // Displays the rest of the USER AGENT string, if any.
  ?>

In short, the script above takes the HTTP_USER_AGENT string which for an iMode browser looks something like DoCoMo/1.0/F50i for the 501 models, and DoCoMo/2.0/F502i/c10 for the 502 models. The first part of the string says DoCoMo indicating that it is an iMode client. The next part indicates the supported HTML version number. The third part indicates the device model number, such as "F501i" and "F502i".

The fourth part, only available on certain 502 models indicates the current cache size. Like with WAP devices, an iMode device can only accept a certain amount of data in one go. The number is in kilobytes, and the default size is 5KB.

[ Main ]   [ 12 - iMode section ]