0

I'm writing a script using Tampermonkey. I need to somehow get the cookie value (with the session id) from the browser.

double-beep
  • 5,031
  • 17
  • 33
  • 41
Messon
  • 107
  • 2
  • 8
  • 3
    This is not a duplicate of the question it was marked as a duplicate of. Specifically, this is for Tampermonkey. The other question is for jQuery. – Dan Overlander Sep 12 '17 at 18:55

1 Answers1

1

You can use COOKIE plugin.

To create a cookie:

$.cookie("example", "foo");

Get a cookie:

$.cookie("example")

Delete a cookie:

$.removeCookie("example");

as community wiki pointed out here.

To use that plugin in Tampermonkey, first you need to load jQuery and then add this plugin:

// @require http://code.jquery.com/jquery-latest.js
// @require https://raw.githubusercontent.com/js-cookie/js-cookie/master/src/js.cookie.js
Nico_
  • 1,388
  • 17
  • 31
Mert Metin
  • 411
  • 1
  • 8
  • 21