title: Repeating GET requests to Arduino web server
body: <p>So, I am currently working on a home automation project using an Arduino + Ethernet shield which is used as a web server. The webpage on the Arduino uses basic Ajax to send requests without refreshing the page or adding anything after the URL.</p>
  
  <p>Here is the script:</p>
  
  <pre><code>    &lt;script type="text/javascript"&gt;
          function GetArduino(url) {
              var request = new XMLHttpRequest();
              request.open("GET", url , false);
              request.send();
          }
      &lt;/script&gt;
  </code></pre>
  
  <p>In the HTML page I use the following to send the requests:</p>
  
  <pre><code>&lt;a href="javascript:GetArduino('?L=36')"  class="op"&gt;&lt;/a&gt;
  </code></pre>
  
  <p>I then read out the HTTP requests on the Arduino and use the "L=XX" code to activate the proper lights or blinds in my house.</p>
  
  <p><strong>Now for the problem:</strong></p>
  
  <p>When using the webpage on my iPhone, every HTTP request is send 3 times in a row. This results in my lights going ON -> OFF -> ON when using Safari on my iPhone. When using Chrome on the same device, this doesn't happen.</p>
  
  <p>The HTTP request looks like this on the Arduino (3 times):</p>
  
  <pre><code>new client
  GET /?L=29 HTTP/1.1
  Host: 192.168.1.177
  Referer: http://192.168.1.177/
  Accept-Encoding: gzip, deflate
  Accept: */*
  Accept-Language: en-us
  Connection: keep-alive
  User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 7_1 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Version/7.0 Mobile/11D167 Safari/9537.53
  </code></pre>
  
  <p>I also noticed that Chrome does the same thing (triple HTTP request) the first time the page is loaded. After that, everything is fine.</p>
  
  <p>I'm no expert in programming, so I'm probably overlooking something obvious here?</p>