title: window.location causing continuous loop using
body: <p>I'm attempting to append to the URL, a query string based on a particular condition. The problem I'm having is, the following code causes the page to loop continuously:</p>
  
  <pre><code>function taoExtendedIdleTime() {
    if (trackingJson.loginType === 'explicit') {
      var myURL = window.location;
      window.location = myURL + "&amp;debugMode=true&amp;setIdleTime=60000";
    } 
  } 
  
  taoExtendedIdleTime();
  </code></pre>
  
  <p>To correct this, I attempted the following, which checks if this query already exists. If not, add it:</p>
  
  <pre><code>function taoExtendedIdleTime() {
    if (trackingJson.loginType === 'explicit') {
      var myURL = window.location;
        if (myURL.indexOf("&amp;debugMode=true&amp;setIdleTime=60000") == -1) {
          window.location = myURL + "&amp;debugMode=true&amp;setIdleTime=60000";
        }
    } 
  } 
  
  taoExtendedIdleTime();
  </code></pre>
  
  <p>In my dev environment, this doesn't get executed at all. When I add it to Console, I get the following error: Uncaught TypeError: myURL.indexOf is not a function, and references the fourth line of this snippet: if(myURL.indexOf...).</p>
  
  <p>Any help/guidance you can provide is most appreciated!!</p>