HELP - Arduino + Ethernet Shield - Button Just work with Internet Explorer

Hi guys.
I'm using an Arduino Duemilanove + Ethernet Shield W5100
Clicking the buttons, the code is sent in the url and the arduino read and makes the action of turning on or off.
The project is working, but only with internet explorer. With other browsers like monzila firefox, google chrome and my phone is not working.
I would like to thank ZOOMKAT. I modified the his codes, to access more ports

what am i doing wrong here?
thank

The arduino code:

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

int LuzFrente       =2;
int LuzCozinha      =3;
int Portao          =4;
int PortaoFrente    =5;
int PortaoCozinha   =6;
int LuzSala         =7;
int LuzQuarto       =8;


byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address
byte ip[] = { 192, 168, 2, 102 }; // ip in lan
byte gateway[] = { 192, 168, 2, 1 }; // internet access via router
byte subnet[] = { 255, 255, 255, 0 }; //subnet mask
EthernetServer server(84); //server port

String readString; 

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

void setup(){

  pinMode(LuzFrente, OUTPUT); //pin selected to control
  pinMode(LuzCozinha, OUTPUT);
  pinMode(Portao, OUTPUT);
  pinMode(PortaoFrente, OUTPUT);
  pinMode(PortaoCozinha, OUTPUT);
  pinMode(LuzSala, OUTPUT);
  pinMode(LuzQuarto, OUTPUT);
  
  //start Ethernet   
  Ethernet.begin(mac, ip, gateway, subnet);
  server.begin();

  
  //enable serial data print 
  Serial.begin(9600); 
  Serial.println("server LED test 1.0"); // so I can keep track of what is loaded
}

void loop(){
  // Create a client connection
  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 

          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>PROJETO 2012 HSH KEVIN</TITLE>"); // NOME QUE APARECE NO NAVEGADOR
          client.println("</HEAD>");
          client.println("<BODY>");

          client.println("<H1>Automacao Projeto 2012 HSH</H1>");
          
          client.println("<H3>Luz Da Frente</H3>");
          client.println("
<input type=\"button\" value=\"ON\" onmousedown=\"location.href ('/?2on');\"/>"); 
          client.println("<input type=\"button\" value=\"OFF\" onmousedown=\"location.href ('/?2off');\"/>");        
 
          
          client.println("<H3>Luz Da Cozinha</H3>");
          client.println("
<input type=\"button\" value=\"ON\" onmousedown=\"location.href ('/?3on');\"/>"); 
          client.println("<input type=\"button\" value=\"OFF\" onmousedown=\"location.href ('/?3off');\"/>");
          
          
          client.println("<H3>Portao</H3>");
          client.println("
<input type=\"button\" value=\"ON\" onmousedown=\"location.href ('/?4on');\"/>"); 
          client.println("<input type=\"button\" value=\"OFF\" onmousedown=\"location.href ('/?4off');\"/>");        
 
          
          client.println("<H3>Portao Frente</H3>");
          client.println("
<input type=\"button\" value=\"ON\" onmousedown=\"location.href ('/?5on');\"/>"); 
          client.println("<input type=\"button\" value=\"OFF\" onmousedown=\"location.href ('/?5off');\"/>");
          
          
          client.println("<H3>Portao Cozinha</H3>");
          client.println("
<input type=\"button\" value=\"ON\" onmousedown=\"location.href ('/?6on');\"/>"); 
          client.println("<input type=\"button\" value=\"OFF\" onmousedown=\"location.href ('/?6off');\"/>");
          
          client.println("<H3>Luz Sala</H3>");
          client.println("
<input type=\"button\" value=\"ON\" onmousedown=\"location.href ('/?7on');\"/>"); 
          client.println("<input type=\"button\" value=\"OFF\" onmousedown=\"location.href ('/?7off');\"/>");        
 
                                           
                    
          client.println("</BODY>");
          client.println("</HTML>");
 
          
          delay(1);
          //stopping client
          client.stop();

          ///////////////////// control arduino pin
          if(readString.indexOf("2on") >0)//checks for on
          {
            
            digitalWrite(2, HIGH);    // set pin 2 high
            Serial.println("LuzSala On");
          }
          if(readString.indexOf("2off") >0)//checks for off
          {
           
            digitalWrite(2, LOW);    // set pin 2 low
            Serial.println("LuzSala Off");
          }
          
          if(readString.indexOf("3on") >0)//checks for on
          {
            digitalWrite(3, HIGH);    // set pin 3 high
            Serial.println("LuzCozinha On");
          }
          if(readString.indexOf("3off") >0)//checks for off
          {
            digitalWrite(3, LOW);    // set pin 3 low
            Serial.println("LuzCozinha Off");
          }
          
          if(readString.indexOf("4on") >0)//checks for on
          {
            digitalWrite(4, HIGH);    // set pin 4 high
            Serial.println("Portao On");
          }
          if(readString.indexOf("4off") >0)//checks for off
          {
            digitalWrite(4, LOW);    // set pin 4 low
            Serial.println("Portao Off");
          }
          
          if(readString.indexOf("5on") >0)//checks for on
          {
            digitalWrite(5, HIGH);    // set pin 5 high
            Serial.println("PortaoFrente On");
          }
          if(readString.indexOf("5off") >0)//checks for off
          {
            digitalWrite(5, LOW);    // set pin 5 low
            Serial.println("PortaoFrente Off");
          }
          if(readString.indexOf("6on") >0)//checks for on
          {
            digitalWrite(6, HIGH);    // set pin 6 high
            Serial.println("PortaoCozinha On");
          }
          if(readString.indexOf("6off") >0)//checks for off
          {
            digitalWrite(6, LOW);    // set pin 7 low
            Serial.println("LuzSala Off");
          }
          if(readString.indexOf("7on") >0)//checks for on
          {
            digitalWrite(7, HIGH);    // set pin 6 high
            Serial.println("PortaoCozinha On");
          }
          if(readString.indexOf("7off") >0)//checks for off
          {
            digitalWrite(7, LOW);    // set pin 7 low
            Serial.println("LuzSala Off");
          }
         
                      
          
          
          //clearing string for next read
          readString="";

        }
      }
    }
  }
}

Anybody?
How i put different buttons ??? thank

There is a bug in the JavaScript on the button elements.

Where there is:

onmousedown=\"location.href ('/?5on');

You need to replace with:

onmousedown=\"location.href = '/?5on';\"

The original code implies that 'href' is a method of the 'location' object, but what you in fact need to be doing is setting 'href' to a value of '/?5on'.

August 13, 2012

Hi:

In regard to Michael Margolis's book (Arduino Cookbook), there are a couple of programs on page 500 (give or take) of the book. Does anyone know if these time type sketches will be forward compatible with ipv6 whenever it gets fully implemented? I'm not sure that there will be a huge snag issue surrounding the upgrade, but I'm not sure that there will NOT be one either??? Any help with this would be appreciated.

thank you very much :slight_smile:
Your tip helped me a lot.
It's all going well

How to have a username and password before accessing these commands? :sweat_smile:
hug