Retrieve a cookie from a different path
问题 My current document URL is http: //127.0.0.1/foo and I need to change the value of a cookie for http: //127.0.0.1/bar. document.cookie is empty because document's URL is foo. For the moment, I just want to read the cookie value. Any clue? 回答1: When you create the cookie, if you set the path to '/' instead of 'foo' you will be able to read it anywhere on the domain, including '/foo', '/bar', etc. 回答2: You can create an <iframe> pointed at a resource inside /bar , and cross-frame-script into it