Using a webpage to control/monitor pins - Browser compatibility

The program below does a fair number of things but the issue I'm having is with the web server. In Firefox it works perfectly, exactly how I want it to. When the form is submitted the same page reloads and all pins read/write correctly. In Chrome and Safari I get a blank page after the form is submitted. In Internet Explorer it sends me back to the root page after the form is submitted. In all cases the POST data is successfully sent to the Arduino but I am wanting the browser to stay on the same page. Thoughts?

I've run the resulting HTML source code through a validator and cleared up any errors I got there but I still get the same results with the various browsers.

I'm not sure if this is an HTML issue or a webserver code issue but I've been banging my head against this for days and haven't found anything to resolve the issue.

My current code is below. (chopped out mostly irrelevant portions due to character limit, attached .ino file instead) Thanks in advance.

#include "SPI.h"
#include "Ethernet.h"
#include "WebServer.h"
#include "EthernetUDP.h"

#define PREFIX ""
WebServer webserver(PREFIX, 80);

void defaultCmd(WebServer &server, WebServer::ConnectionType type, char *, bool)
{
  server.httpSuccess();
  if (type != WebServer::HEAD)
  {
    P(helloMsg) = "<h1>Hello</h1><a href=\"private.html\">Private page</a>";
    server.printP(helloMsg);
  }
}

void privateCmd(WebServer &server, WebServer::ConnectionType type, char *, bool)
{
  /* if the user has requested this page using the following credentials
  * username = user
  * password = user
  * display a page saying "Hello User"
  *
  * the credentials have to be concatenated with a colon like
  * username:password
  * and encoded using Base64 - this should be done outside of your Arduino
  * to be easy on your resources
  *
  * in other words: "dXNlcjp1c2Vy" is the Base64 representation of "user:user"
  *
  * if you need to change the username/password dynamically please search
  * the web for a Base64 library */
  if (server.checkCredentials("dXNlcjp1c2Vy"))
  {
    if (type == WebServer::POST)
  {
    bool repeat;
    char name[16], value[16];
    do
    {
      /* readPOSTparam returns false when there are no more parameters
      * to read from the input. We pass in buffers for it to store
      * the name and value strings along with the length of those
      * buffers. */
      repeat = server.readPOSTparam(name, 16, value, 16);

      /* this is a standard string comparison function. It returns 0
      * when there's an exact match. We're looking for a parameter
      * here. */
      if (strcmp(name, "R1") == 0)  //R1 through R4 are used for relay resets
      {
        relay1Reset = true;
        digitalWrite(relayPin1, LOW);
        resetTime1 = currentTime;
      }
      if (strcmp(name, "R2") == 0)
      {
        relay2Reset = true;
        digitalWrite(relayPin2, LOW);
        resetTime2 = currentTime;
      }
      if (strcmp(name, "R3") == 0)
      {
        relay3Reset = true;
        digitalWrite(relayPin3, LOW);
        resetTime3 = currentTime;
      }
      if (strcmp(name, "R4") == 0)
      {
        relay4Reset = true;
        digitalWrite(relayPin4, LOW);
        resetTime4 = currentTime;
      }
      if (strcmp(name, "Reset") == 0) //arduino reset
      {
        resetDetect = true;
      }
      if (strcmp(name, "Arm") == 0) //door alarm toggle
      {
        armed = !armed;
        alarmTripTime = 0;
        noTone(audioAlarmPin);
      }
      if (strcmp(name, "ResetTime") == 0) //changing the relay reset delay
      {
        int tempDelay = strtoul(value, NULL, 10);
        if (tempDelay > 0)
          resetDelay = tempDelay;
      }
      } while (repeat);
      server.httpSeeOther(PREFIX);
      return;
    }
    server.httpSuccess();
    if (type == WebServer::GET)
    {  
      int hours = floor(currentTime/3600000);
      int mins = floor(currentTime/60000) - (hours * 60);
      int secs = floor(currentTime/1000) - (hours * 3600) - (mins * 60);
      
      P(msg1) = "<!DOCTYPE html><html><head><title>Tabor Remote Control</title>"
                "<script type='text/javascript'>"
                "function stopRKey(evt) {"
                "var evt = (evt) ? evt : ((event) ? event : null);"
                "var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);"
                "if ((evt.keyCode == 13) && (node.type=='text'))  {return false;}"
                "}"
                "document.onkeypress = stopRKey;"
                "</script>"
                "<style>"
                  "body"
                  "{"
                  "background-color:#d0e4fe;"
                  "}"
                  "h1"
                  "{"
                  "}"
                  "p"
                  "{"
                  "font-family:'Times New Roman';"
                  "font-size:20px;"
                  "}"
                "</style>"
                "</head>"
                "<body>"
                "<hr>"
                "<p>Running for: ";
      server.printP(msg1);      
      server.print(hours);
      server.print(":");
      if (mins < 10)
        server.print("0");
      server.print(mins);
      server.print(":");
      if (secs < 10)
        server.print("0");
      server.print(secs);
      P(msg2) = "
</p>"
                "<hr>"
                "<h1>Relay Reset</h1>"
                "<form action='private.html' method='post'>"
                "<button name=R1 value=1>Relay 1</button>";
      server.printP(msg2);
      if (relay1Reset)
        server.println(" Open
");
      else
        server.println(" Closed
");
      server.print("<button name=R2 value=1>Relay 2</button>");
      if (relay2Reset)
        server.println(" Open
");
      else
        server.println(" Closed
");
      server.print("<button name=R3 value=1>Relay 3</button>");
      if (relay3Reset)
        server.println(" Open
");
      else
        server.println(" Closed
");
      server.print("<button name=R4 value=1>Relay 4</button>");
      if (relay4Reset)
        server.println(" Open");
      else
        server.println(" Closed");
      P(msg3) = "
"
                "<input type=text name=ResetTime value =";    
      server.printP(msg3); 
      server.print(resetDelay);      
      server.println("> Relay Reset Time (ms)
");
      P(msg4) = "<input type=submit value=Submit>"
                "
"
                "
"
                "<button name=Reset value=1>Reset Arduino</button>
"
                "<hr>"
                "<H2>Alarm</H2>";
      server.printP(msg4);
      if (armed)
        server.println("<button name=Arm value=1>Disarm</button>
");
      else
        server.println("<button name=Arm value=1>Arm</button>
");
      P(msg5) = "</form>"
                "
"
                "<hr>"
                "<h1>Monitor</h1>
"
                "Monitor 1: ";
      server.printP(msg5);
      float tempValue = (5 * (monitorValue1/1023));
      server.print(tempValue);
      server.print("V<hr></body></html>");
    }
  }
  else
  {
    /* send a 401 error back causing the web browser to prompt the user for credentials */
    server.httpUnauthorized();
  }
}

void setup()
{
  Serial.begin(9600);
  digitalWrite(deviceResetPin, HIGH);
  pinMode(deviceResetPin, OUTPUT);
  pinMode(alarmPin, INPUT);
  pinMode(relayPin1, OUTPUT);  
  digitalWrite(relayPin1, HIGH);
  pinMode(relayPin2, OUTPUT);  
  digitalWrite(relayPin2, HIGH);
  pinMode(relayPin3, OUTPUT);  
  digitalWrite(relayPin3, HIGH);
  pinMode(relayPin4, OUTPUT);  
  digitalWrite(relayPin4, HIGH);
  Ethernet.begin(mac, ip, myDns, gateway, subnet);
  webserver.setDefaultCommand(&defaultCmd);
  webserver.addCommand("index.html", &defaultCmd);
  webserver.addCommand("private.html", &privateCmd);
  webserver.begin();
  Udp.begin(localPort);
}

void loop()
{
  /* process incoming connections one at a time forever */
  webserver.processConnection(buff, &len);
}

RelayManager4.ino (14.4 KB)