Hey, who keeps chaning my escaped character!

Giganews Newsgroups
Subject: Hey, who keeps chaning my escaped character!
Posted by:  Rob Morrison (rober…@san.rr.com)
Date: Sun, 22 Aug 2004

The sample below demonstates an issue that I cannot seem to workaround.  I
have an Url with a value that contains an ampersand.  I have escaped the Url
using both the hex value and it works fine when used in a href.  But, if I
pass the same Url to the open() function it unescapes my ampersand while
leaving the other escaped untouched.  This behavior is the same for both IE
and Mozilla Firefox, I guess this is known behvoir unknown to me.

Does anybody know how to pass an ampersand in a name value pair to the open
function?

Sample:

<%@ Language=javascript %>
<html>
<script language="javascript">
        function showEscapeVar() {
                alert('<%=Request.QueryString("escapevar").Item%>');
                return false;
        }
</script>
<body onload="showEscapeVar()">

        <a href="whoatemyescape.asp?escapevar=Sanford%20%26%20Son">Href
Escape</a>

        <a
href="javascript:open('whoatemyescape.asp?escapevar=Sanford%20%26%20Son')">P
opup Escape</a>

</body>
</html>

Replies