I'm using this function for base64
decode/encode URL in javascript
but i've seen many gives notice about making Base64 encoded String URL friendly and to use
// if this is your Base64 encoded string
var str = 'VGhpcyBpcyBhbiBhd2Vzb21lIHNjcmlwdA==';
// make URL friendly:
str = str.replace(/\+/g, '-').replace(/\//g, '_').replace(/\=+$/, '');
// reverse to original encoding
str = (str + '===').slice(0, str.length + (str.length % 4));
str = str.replace(/-/g, '+').replace(/_/g, '/');
I see it only replce +
with -
and \
with _
so what is the point! i mean why should i?