Using encoded URL in Javascript
Hi .. tricky thing...
I have a URL string like
register.jsp?cust=100
and now i want to send it to another jsp and this jsp reads out the url from request.
action.jsp?URL=<%= encode("register.jsp?cust=100") %>
and now i want to send this string away with javascript (beause of forms) ...
parent.main.location ="action.jsp?URL=<encodedURL>
but action cannot read out the URL parameter from request, because javscript "re-encoded" it again.
Does sb have an idea !?
Thanx a lot .... Markus
[677 byte] By [
mindchild] at [2007-9-26 12:49:08]

Hi Markus,
I tested with IE5.5 and Netscape6.0. You have to test with other type of Browser:
Look for the Global object:
<script language="javascript1.2">
var str="this is a encode URL";
alert (encodeURIComponent(str));
alert (decodeURIComponent(str));
</script>
-- Paul
I needed a solution for Javascript 1.0 ..
now i use href normal Link with URL Parameter (encoded) and target to main frame .. and an onclick event to do the rest javascript stuff ...
<a href="action.jsp?URL=<%=java.net.URLEncoder.encode(URL)%> target="main" onClick="refreshHeadFrame();">Link</a>
This works so far .. =]