title: Using javascript how to break the while loop after a set time?
body: <p>I have a while loop which looks like this:</p>
  
  <pre><code>while(s1 != "#EANF#")
  {
  iimPlay("CODE:REFRESH");
  iimPlay("CODE:TAG POS=1 TYPE=* ATTR=TXT:Contacted:* EXTRACT=TXT")
  var s1 = iimGetLastExtract();
  }
  </code></pre>
  
  <p>it will refresh the web page until it finds what it wants. However sometimes it becomes an infinite loop and I want to simply set a timer so that it would break the while loop and carry on. I tried looking at settimeout but couldn't figure out how to do it. I want this while loop to just give up refreshing the web page if it doesn't find what it wants after lets say 3 minutes.</p>