This is an example implementation of a cookie with which you can set cookies.

manifest.json
{ "name" : "Cookie API Demo", "version" : "1", "description" : "This is demonstration of Cookie API", "permissions": [ "cookies","<all_urls>"], "browser_action": { "default_icon": "screen.png", "default_popup":"popup.html" }, "manifest_version": 2 }
popup.js
function cookieinfo(){ chrome.cookies.set({"name":"Sample1","url":"http://developer.chrome.com/extensions/cookies.html","value":"Dummy Data"},function (cookie){ console.log(JSON.stringify(cookie)); console.log(chrome.extension.lastError); console.log(chrome.runtime.lastError); }); } window.onload=cookieinfo;
popup.html
<html> <head> <script src="popup.js"></script> </head> <body> </body> </html>
source share