title: Javascript to modify current URL?
body: <p>I am trying to write a javascript that detects if the current page contains a "?" in the url and, if it does, get everything in the url up to the "?" and then reload the window with this new url.  I've tried this:</p>
  
  <pre><code>var curr_url = window.location.toString();
  if (curr_url.indexOf('?')!== -1){
      var goodpart = curr_url.split('?');
      //alert(goodpart[0]);
      window.location = goodpart[0];
  } 
  </code></pre>
  
  <p>But it doesn't seem to work. Either it does nothing for some pages or it works but keeps reloading the page over and over.</p>