Read values from webpage to control relay (Ethernet Shield)

I finally got some time to continue this project.

Picking up where I left off, the following code is working fine. With one exception when I click the on or off button using google chrome as the browser it only blinks off the led and the turns the led back on. So if anyone knows why this is happening I would be happy to learn about it, but for now I will use explorer and safari as browser when communicating with arduino.

Also if anyone know about a good tutorial on ethernet syntax would be much appreciated.

//George-Xrik 31-03-12, updated
//zoomkat 12-08-11, combined client and server
//simple button GET with iframe code
//for use with IDE 1.0
//open serial monitor and send an g to test client and
//see what the arduino client/server receives
//web page buttons make pin 4 high/low
//use the \ slash to escape the " in the html 
//address will look like http://192.168.1.177 or http://88.203.15.76 when submited
//for use with W5100 based ethernet shields

#include <SPI.h>
#include <Ethernet.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address
IPAddress ip(192,168,2,130); // ip in lan
IPAddress gateway(192,168,2,1); // internet access via router
IPAddress subnet(255,255,255,0); //subnet mask
IPAddress myserver(208,104,2,86); // zoomkat web page
EthernetServer server(80); //server port
EthernetClient client;
String readString; 

//////////////////////

void setup(){

  pinMode(8, OUTPUT); //pin selected to control
  Ethernet.begin(mac, ip, subnet, gateway); 
  server.begin();
  Serial.begin(9600); 
  Serial.println("server/client 1.0 test 31/03/12"); // keep track of what is loaded
  Serial.println("Send g in serial monitor to test client"); // what to do to test client
}

void loop(){
  // check for serial input
  if (Serial.available() > 0) 
  {
    byte inChar;
    inChar = Serial.read();
    if(inChar == 'g')
    {
      sendGET(); // call sendGET function
    }
  }  

  EthernetClient client = server.available();
  if (client) {
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();

        //read char by char HTTP request
        if (readString.length() < 100) {

          //store characters to string 
          readString += c; 
          //Serial.print(c);
        } 

        //if HTTP request has ended
        if (c == '\n') {

          ///////////////
          Serial.println(readString); //print to serial monitor for debuging 

            //now output HTML data header
          if(readString.indexOf('?') >=0) { //don't send new page
            client.println("HTTP/1.1 204 Zoomkat");
            client.println();
            client.println();  
          }
          else {
            client.println("HTTP/1.1 200 OK"); //send new page
            client.println("Content-Type: text/html");
            client.println();

            client.println("<HTML>");
            client.println("<HEAD>");
            client.println("<TITLE>Arduino GET test page</TITLE>");
            client.println("</HEAD>");
            client.println("<BODY>");

            //client.println("<H1>Zoomkat's simple Arduino 1.0 button</H1>");
            client.println("<H1>George's simple Arduino 1.0 button</H1>");

            client.println("<a href=\"/?on\" target=\"inlineframe\">ON</a>"); 
            client.println("<a href=\"/?off\" target=\"inlineframe\">OFF</a>"); 

            //client.println("<IFRAME name=inlineframe src=\"res://D:/WINDOWS/dnserror.htm\" width=1 height=1\">");
            client.println("<IFRAME name=inlineframe style=\"display:none\" >");          
            client.println("</IFRAME>");

            client.println("</BODY>");
            client.println("</HTML>");
          }

          delay(1);
          //stopping client
          client.stop();

          ///////////////////// control arduino pin
          if(readString.indexOf("on") >0)//checks for on
          {
            digitalWrite(8, HIGH);    // set pin 4 high
            Serial.println("Led On");
          }
          if(readString.indexOf("off") >0)//checks for off
          {
            digitalWrite(8, LOW);    // set pin 4 low
            Serial.println("Led Off");
          }
          //clearing string for next read
          readString="";

        }
      }
    }
  }
} 

//////////////////////////
void sendGET() //client function to send/receie GET request data.
{
  if (client.connect(myserver, 80)) {
    Serial.println("connected");
    client.println("GET /~shb/arduino.txt HTTP/1.0");
    client.println();
  } 
  else {
    Serial.println("connection failed");
    Serial.println();
  }

  while(client.connected() && !client.available()) delay(1); //waits for data
  while (client.connected() || client.available()) { //connected or data available
    char c = client.read();
    Serial.print(c);
  }

  Serial.println();
  Serial.println("disconnecting.");
  Serial.println("==================");
  Serial.println();
  client.stop();

}

the following is the serial communication

server/client 1.0 test 31/03/12
Send g in serial monitor to test client
connected
HTTP/1.1 200 OK
Date: Sat, 28 Apr 2012 15:03:54 GMT
Server: Apache
Last-Modified: Sat, 13 Nov 2010 16:31:40 GMT
Accept-Ranges: bytes
Content-Length: 51
Connection: close
Content-Type: text/plain; charset=UTF-8

Woohoo! Your arduino ethernet client works!
zoomkat
disconnecting.
==================

GET /?on HTTP/1.1                 >>> from Safari (iphone)

Led On                                  >>> from Safari (iphone)
GET /?off HTTP/1.1                >>> from Safari (iphone)

Led Off                                 >>> from Safari (iphone)
GET /?on HTTP/1.1                 >>> from explorer 

Led On                                  >>> from explorer 
GET /?off HTTP/1.1                >>> from explorer

Led Off                                 >>> from explorer
GET /?on HTTP/1.1                 >>> from chrome

Led On                                 >>> from chrome
GET /favicon.ico HTTP/1.1     >>> from chrome

Led On                                >>> from chrome
GET /?off HTTP/1.1              >>> from chrome

Led Off                               >>> from chrome
GET /favicon.ico HTTP/1.1     >>> from chrome

Led On                                >>> from chrome

What should be noted is that i only click on and than off once on each browser, chrome acts strangely and turns the led back on.