title: Javascript window.open() escaping ampersands
body: <p>I am upgrading a legacy application and it uses the annoying practice of using Javascript <code>window.open()</code> to open popup windows in order to set values.  I'm having a problem passing querystring variables to that popup window, since the url is built server side.</p>
  
  <p>Example</p>
  
  <p>JS:</p>
  
  <pre><code>function popupwindow(vLink) { 
      window.open(vLink, 'Detail','width=600px,height=545px,status=yes,help=no,scrollbars=yes,resizable=yes,top=350');
  }
  </code></pre>
  
  <p>XML</p>
  
  <pre><code>&lt;asp:Label ID="lblOpener" runat="server" Text="_"&gt;&lt;/asp:Label&gt;
  </code></pre>
  
  <p>Server Side </p>
  
  <pre><code>int ditem = 123;
  string dcode = "ABC";
  string vLink = string.Format("detail.aspx?item={0}&amp;code={1}", ditem, dcode);
  lblOpener.Attributes.Add("onclick", "popupwindow('" &amp; vLink &amp; "');");
  </code></pre>
  
  <p>When the label is clicked I am expecting the popup to open with the querystring:</p>
  
  <p><code>http://detail.aspx?item=123&amp;code=ABC</code></p>
  
  <p>Instead, I get something like this:
  <code>http://detail.aspx?item=123&amp;amp%3bcode=ABC</code></p>
  
  <p>How can I prevent this from happening?</p>