title: How Can I Modify/"Spoof" Standard Browser JS DOM Objects (Window.location) at Runtime?
body: <p>I'd like to dynamically change some of the standard JS DOM objects from within a web browser.  </p>
  
  <p>For instance, when I execute:</p>
  
  <pre><code>var site = location;
  </code></pre>
  
  <p>I want to specify a new value for my browser's "window.location" object other than the "correct" one (the URL used to access the requested page) at run time, either through a debugger-like interface or even programmatically if need be.</p>
  
  <p>Although Firebug advertises the capability to do something similar via its "DOM Inspector," whenever I try to modify any of the DOM values while I've paused the Javascript via its debugger, it simply ignores the new value I enter.  After doing some research, it seems that this is a known issue according to this bug report: <a href="http://code.google.com/p/fbug/issues/detail?id=1707" rel="nofollow">http://code.google.com/p/fbug/issues/detail?id=1707</a> .</p>
  
  <p>Theoretically, I could write a program to simply open up an HTTP socket and emulate a browser "user agent," but this seems like a lot of trouble for my purposes.  While I'm asking, does anyone know a good Java/C# library with functions/objects that emulate HTTP headers and parse the received HTML/JS?  I've long dreamt about the existence of such a library but most of the ones I've tried (Java's Apache HttpClient, C#'s System.Net.HttpWebRequest) are far too low-level to make anything worthwhile with minimal planning and a short period of time.</p>
  
  <p>Thanks in advance for recommendations and advice you can provide!</p>