Reputation: 255
How to find out Cookie Path Using Cookie Name? I have a requirement of maintaining a cookie to track exit of an application. I am using window.onbeforeunload event to track exit of a page. Now I have to implement a condition that if referred url is not equal to path of cookie to distinguish between page change within same application to that of application exit. What are the other ways can it be implemented effectively.
Upvotes: 0
Views: 649
Reputation: 1752
You can't do it directly. However you can check where the particular page is having specific cookie or not.
And My Suggestion is create another cookies with path "/"(base path) which will be available in all paths. I mean you have to create separate cookie for every existing cookie and store their paths in newly created cookie. Then only you can track it. This approach also need server side implementation. However, this approach is not recommended(never used) and this will complicate your application architecture.
Here, I assume that If particular cookie path doesn't match with path in address-bar then you want to do some action. In this case,
Upvotes: 1