Cookies enable websites to keep users logged in and remember all preferences. If you want to make sure that browser remembers your activity, you have to turn on the cookies. Since Google Chrome is the most popular browser, we will cover how you can enable cookies on it.

What Are Cookies?

Before we cover how you can enable cookies in Google Chrome, you need to know what cookies are. In the simplest of words, cookies are small files that websites store when you visit them using your browser. The websites would read this information when you visit again and ensure that you have a personalized experience. For instance, the cookie file can contain your session ID which would let the website know about your data and ensure that you are logged into your account. It is worth mentioning that Chrome differentiates third-party cookies from other types of cookies. Third-party cookies enable outside entities to collect data from you and monitor your online activity. If you are concerned about privacy, you will need to block third-party cookies. However, such an action would lead to some website features not working.

Enable Cookies in Chrome on Desktop

The following steps will help you activate cookies on desktop in no time.

  • The first thing that you need to do is open Chrome.
  • Then, you must click the three dots menu at the far top-right.
  • Next, you have to select “Settings” from the menu.
  • Choose “Privacy and Security” from the “Settings” menu.
  • Click on “Site Settings”.
  • Look for “Cookies and Site Data” and select it.
  • When the “Cookies and Other Site Data” section opens, you must enable “Block Third-Party Cookies” from the “General Settings” section. It would enable third-party and first-party cookies while blocking third-party cookies when you use incognito mode.
  • If you want to allow all the cookies in both modes, you have to select “Allow All Cookies” from the same section.
  • That is about it.

Enable Cookies in Chrome on Smartphone

Apple users always have cookies turned on by default which means that they do not have to do anything to enable cookies. On the other hand, Android users can follow the steps mentioned below to enable cookies.

  • Tap the three dots at the far right.
  • Select “Settings”.
  • Click “Site Settings” in the “Advanced” section of “Settings”.
  • Tap “Cookies” when the “Site Settings” page appears for managing cookie settings.
  • Now, the “Cookies” section should appear. You will need to enable “Block Third-Party Cookies for Incognito mode” to activate third-party and first-party cookies.
  • On the other hand, if you want to enable the cookies in both incognito mode and regular mode, you just have to select “Allow Cookies”.
  • That is about it. You can expect to have a great online experience.

Manipulate Cookies for Developers

To enable and disable cookies in Google Chrome, you can use the chrome.cookies API, which is part of the Chrome Extension API. This API provides a number of methods and events that allow you to create, read, update, and delete cookies in the browser.

To use the chrome.cookies API, you will need to create a Chrome extension and include the chrome.cookies API in the extension’s manifest file. The chrome.cookies API requires the cookies permission, which must be specified in the manifest file. Here is an example manifest file that includes the cookies permission:

{
  "manifest_version": 2,
  "name": "My Extension",
  "description": "This is my extension.",
  "version": "1.0.0",
  "permissions": ["cookies"],
  "background": {
    "scripts": ["background.js"]
  }
}

With this manifest file, you can use the chrome.cookies API in your extension’s background script or content script. Here is an example of how to use the chrome.cookies.set method to enable a cookie in Chrome:

// Enable a cookie in Chrome
chrome.cookies.set({
  url: "https://www.example.com",
  name: "mycookie",
  value: "myvalue",
  expirationDate: Math.floor(Date.now() / 1000) + 3600
}, function(cookie) {
  // The cookie has been enabled
});

In this code, the expirationDate option specifies the time when the cookie will expire, in seconds since the Unix epoch. By setting this value to a time in the future, the cookie will be enabled and will be stored in the browser.

To disable a cookie in Chrome, you can use the chrome.cookies.remove method, which takes the URL, name, and optional attributes of the cookie as arguments. Here is an example of how to use this method to disable a cookie in Chrome:

// Disable a cookie in Chrome
chrome.cookies.remove({
  url: "https://www.example.com",
  name: "mycookie"
}, function(details) {
  // The cookie has been disabled
});

With these examples, you can use JavaScript and the chrome.cookies API to enable and disable cookies in Chrome. This allows you to build web applications that can manage cookies and control their behavior in the browser, which can be useful for security, privacy, and other purposes.

Conclusion

After you have gone over the post, you should have no trouble activating cookies in Google Chrome. Make sure to clear cookies from time to time when Chrome has collected many cookies. It will help keep your browser running at full-speed.