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:
- run a local server A
- run a local server B and B has a iframe page which embed page A
- operate server A’s cookies by js-cookies api like fake code blow
Cookies.set('key', 'value', { secure: true, sameSite: 'None', })
- 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
- Enhance note in readme related to cookie deletion Ref: #846 — committed to js-cookie/js-cookie by carhartl 6 months ago
Aaaah, I had been thinking about it, but wasn’t sure. Apparently what’s in the readme also applies to
SameSite
andSecure
… adding this to the readme and closing this. Thank you very much @khanakia for your help! 🙏Here are the 2 ways to test.
First
Second In IFrame