setting cookie using document.cookie issue with iframe

document.cookie not working inside iframe

We have a parent page like https://www.parent-page.com – in this page we have an iframe which is https://www.child-page.com/child

In the child page we have a line to set a cookie document.cookie = “test1=normal” – it was working normally, suddenly stopped working on Windows 10, Chrome 80.0.3987.132 – but it works with mac Chrome 80.0.3987.132

Chromium security updates

This is because of the security updates – we can read more about the samesite cookie here.

SameSite with Secure works

If we want to make the document.cookie works in the child page, we need to add SsameSite=None; Secure

Example:

document.cookie = 'cross-site-cookie2=noneCookie; SameSite=None; Secure';

Created a test page to test all the scenarios here

-Prathap Beschi