0

Well, i think the title is pretty clear, how to encode a string to base64 in JScript?

While researching online i found this:

How to decode a Base64 string in JScript

Yeah, intresting (for Decoding), but im not getting many other documentation and so i dont know how to encode a string.

Does anyone know how to do it?

root823746374
  • 67
  • 1
  • 5
  • Have you tried [this](https://stackoverflow.com/a/247261/692942)? It might not work because JScript is based on ECMAScript v3. – user692942 May 21 '22 at 07:07
  • You might also find [this](https://stackoverflow.com/q/11524268/692942) useful. – user692942 May 21 '22 at 07:14
  • The first one isnt working because JScript isnt JavaScript and doesnt not provide btoa() and atob(), the second one should work, but im sure there is a way to encode a base64 just by calling a function, like for decoding, so i think there is a better way to do it. – root823746374 May 21 '22 at 08:38
  • Like I said, it might not work. As for a native function in JScript, pretty sure one doesn’t exist but [check for yourself](https://learn.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/scripting-articles/yek4tbz0(v=vs.84)). – user692942 May 21 '22 at 11:15
  • JScript in IE 10 and above does support `btoa` and `atob`. You must have been running your code in a lower document mode. See this [answer](https://stackoverflow.com/a/76112829/15764378). – LesFerch Apr 26 '23 at 16:03

0 Answers0