question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to set cookie for specific domain

See original GitHub issue

I am trying to set cookie for a domain but its not working. Here is my code: this.cookieService.set('merchant_data', cookieData, expire, '/', 'abc.example.com');

its not working but when I remove domain it works , how can I set it for domain ?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
dhananjaykumar880commented, Feb 2, 2018

I am also facing same problem

0reactions
CunningFatalistcommented, Jul 4, 2019

@dhananjaykumar880 @kumaraditya1999

Hello,

reading my comment above, I realize that I did not make this point clear enough. If you check out the first of the links above, you will see that you cannot set cookies for other domains. That is also stated in our documentation.

Cheers

Read more comments on GitHub >

github_iconTop Results From Across the Web

Creating a JavaScript cookie on a domain and reading it ...
Just set the domain and path attributes on your cookie, like: <script type="text/javascript"> var cookieName = 'HelloWorld'; var cookieValue ...
Read more >
Set-Cookie - HTTP - MDN Web Docs
The Set-Cookie HTTP response header is used to send a cookie from the server to the user agent, so that the user agent...
Read more >
Working With Cookies and Creating Cookies in JavaScript
If Domain is not specified, the cookie can only be read by the exact domain that has set the cookie. This can be...
Read more >
Cookies, document.cookie - The Modern JavaScript Tutorial
To find a particular cookie, we can split document.cookie by ; ... By default, a cookie is accessible only at the domain that...
Read more >
How to set a cookie to a specific domain in selenium ...
We can set a cookie to a specific domain in Selenium webdriver with Python. A cookie is used to hold information sent by...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found