js-cookie: .remove() API not work when it's runing in a iframe enviroment

Describe the bug As the title discriped

To Reproduce Steps to reproduce the behavior:

  1. run a local server A
  2. run a local server B and B has a iframe page which embed page A
  3. operate server A’s cookies by js-cookies api like fake code blow Cookies.set('key', 'value', { secure: true, sameSite: 'None', })
  4. remove the cookie and you’ll see that ‘key’ not deleleted Cookies.remove('key') Cookies.get('key') // still console 'value'

Expected behavior .remove works great in a nomal websit page expect iframe page

Screenshots it’s quit difficut to show screnn shot.

Desktop (please complete the following information):

  • OS: mac os
  • Browser chrome
  • Version 119.0.6045.199

About this issue

  • Original URL
  • State: closed
  • Created 7 months ago
  • Comments: 20 (12 by maintainers)

Commits related to this issue

Most upvoted comments

Aaaah, I had been thinking about it, but wasn’t sure. Apparently what’s in the readme also applies to SameSite and Secure… adding this to the readme and closing this. Thank you very much @khanakia for your help! 🙏

Screenshot 2023-12-25 at 09 53 36

Here are the 2 ways to test.

First

Second In IFrame