So I'm confused. I know there's lots of Base64 encoders/decoders for JS, but not for the modified, So far searching across stackoverflow has come up dry. I was trying something on BLOGGER to make simple encryption script using btoa() and atob() JS methods to encrypt and then decrypt again the URL On Desktop browsers it goes very well and the original link/url regenerated successfully but when trying on mobile browsers because of this suffix added by blogger at the end of the url (?m=1) that cause all things messy and the final link does not give the original link
Here my codes
// that converts the original url to base64 through btoa()
<input id="myinput" type="text" name="search" />
<input id="shrt" type="submit" value="Shorten" onclick="myFunction()" />
<textarea id="m"></textarea>
<script>
function myFunction() {
var mm = document.getElementById("myinput").value;
var b64 = btoa(mm);
document.getElementById('m').innerHTML = "https://basebb.blogspot.com/p/go.html?url=" + b64;};
</script>
then I use the window.location.href to get the link and generate another link the the base64 encryption
<a id="lnk" href="" style="font-size: 40px;">FirstLink</a>
<script>
var str = window.location.href;
var res = str.substr(42, );
var a = document.getElementById('lnk');
a.href = "https://basebb.blogspot.com/2018/09/art.html?url=" + res;
</script>
and finally I use atob() to recover the original url here
<a id="lnk" href="" style="font-size: 40px;">FinalLink</a>
<script>
var str = window.location.href;
var str1 = str.substr(49, );
var a = document.getElementById('lnk');
a.href = atob(str1);
</script>
trying for (https://twitter.com/) it gives me (https://basebb.blogspot.com/p/go.html?url=aHR0cHM6Ly90d2l0dGVyLmNvbS8=)
as I said it works well on desktop but on mobile after second redirect it gives me that
(https://basebb.blogspot.com/p/go.html?url=aHR0cHM6Ly90d2l0dGVyLmNvbS8%3D&m=1)
note that (%3D&m=1) at the ending it causes the all problem
the other problem is that this (%3D&m=1) changed with every link changed in length and characters also
I tried many methods like substr(), slice(), replace(), but no one works and the problem still exists
please any help?? and sorry for my bad English