I have to handle a case where multiple urls should be passed in the url query params, for example:
http://example.com/?landing=<url1>&referrer=<url2>
url1: http://test1.com/test.html?param=x¶m2=y
url2: http://test2.com/test/test.html?p=x&c=&...
At the moment I'm trying the following without success:
var l = encodeURIComponent(document.URL);
var r = encodeURIComponent(document.referrer);
window.location.href = 'http://example.net/?landing=' + l + '&ref=' + r;
My question is: What would be the best way to encode url1 and url2? Should I use encodeURIComponent or would it be better to use base64 encoding for those params or perhaps something else?