Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GM_cookie.set and GM_cookie.delete API are not functioning #134

Closed
cloudswave opened this issue Nov 12, 2023 · 4 comments
Closed

GM_cookie.set and GM_cookie.delete API are not functioning #134

cloudswave opened this issue Nov 12, 2023 · 4 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@cloudswave
Copy link

The GM_cookie.list API is OK, but when I try to invoke GM_cookie.set and GM_cookie.delete APIs, they are not functioning. Can you help me?
The tampermonkey document
Example:

GM_cookie.set({
  url: 'https://example.com',
  name: 'name',
  value: 'value',
  domain: '.example.com',
  path: '/',
  secure: true,
  httpOnly: true,
  expirationDate: Math.floor(Date.now() / 1000) + (60 * 60 * 24 * 30) // Expires in 30 days
}, function(error) {
  if (error) {
    console.error(error);
  } else {
    console.log('Cookie set successfully.');
  }
});

GM_cookie.delete({ name: 'cookie_name' }, function(error) {
    if (error) {
        console.error(error);
    } else {
        console.log('Cookie deleted successfully');
    }
});
@JingMatrix
Copy link
Owner

The design principle is given in #115.
Please offer a whole script so that I may explain in more details.

@cloudswave
Copy link
Author

cloudswave commented Nov 13, 2023

The design principle is given in #115. Please offer a whole script so that I may explain in more details.

Install the test script, then opening any webpage and it will display test buttons.
Here is a desktop edge Tampermonkey BETA invoke GM_cookie successfully screenshot.
image

ChromeXt script screenshot in the android via browser
Screenshot_2023-11-13-11-55-37-35_a252b927494330cdc2c8ba3b3f952e5e

@JingMatrix JingMatrix added bug Something isn't working good first issue Good for newcomers labels Nov 13, 2023
@JingMatrix
Copy link
Owner

The problem was mainly that your script missed the domain parameter, which is now required by Chromium browsers.
Now this is fixed, as I add the default domain paremeter.

@cloudswave
Copy link
Author

cloudswave commented Nov 14, 2023

The problem was mainly that your script missed the domain parameter, which is now required by Chromium browsers. Now this is fixed, as I add the default domain paremeter.

Verified, the problem has been fixed. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants