I am confused about why javascript protocol decodes the encoded URL, for example:
<a href="javascript:myFunction('%3DcDO4w67epn64o76');">press</a>
function myFunction(id)
{
alert(id); //it will generate =cDO4w67epn64o76
}
I am using these strings in encryption and decryption.
Please provide me with a real reason and a solution (the reason is very important for me), I know I can replace the (=) sign, but I am afraid of the rest of the encoded strings to be decoded also by the wrapper.
Note: in php, the GET, REQUEST Global variables, the url is decoded automatically.
Because it's in an
href
attribute, where URLs are expected, so the browser is "normalizing" the URI-encoding of the "URL" (which is using thejavascript
pseudo-scheme).You can put it in a different attribute and then get that, like so:
...although I discourage using
onclick="..."
handlers. Instead: