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
  • 4,567
  • 13
  • 30
  • 40
Messon
  • 107
  • 2
  • 7
  • 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

0

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,148
  • 14
  • 29
Mert Metin
  • 401
  • 1
  • 6
  • 21