Author: Darren Wogan <darrenw@s...>
Subject: How do you 'URL Encode' in client side JavaScript
Body: I have a client side JavaScript string which I want to URL Encode,
to
include it as part of a URL address.
The string may contain spaces and a number of other non-URL friendly
characters (e.g. '\').
I know there is an ASP function to do this, Server.URLEncode(string).
However how do you do this in client side JavaScript, e.g. :
// message to be encoded
msg = "Some Example Message which might state e.g. a path (e.g.
'c:\new path')"
// Call new page to display the message
newURL = "/arm/LogClientMsg.asp?msg="
// presumably a function exists to encode it, e.g.:
newURL += msg.encodeToURL()
// then go to new page with this string
location.href = newURL
P.S. I know that I could submit a form , however that is not ideal in this
situation. Surely I don't need to use 'replace()' for every special
character?!
Darren Wogan