问题
I am building a website that is loaded into a frameset
by other sites (where the domain names are different for the parent site).
This works fine in all browsers (including IE6), except for IE7. It is not registering the session at all and simply does not work.
Site is implemented using LAMP, MySQL 5, and PHP 5 - yeah, probably not relevant to the actual problem but still worth mentioning.
Any suggestions?
回答1:
You might want to try adding a P3P header to your site as follows:
header('P3P: CP="ALL ADM DEV PSAi COM OUR OTRo STP IND ONL"');
See this blog post for details.
回答2:
That's a standard Internet Explorer security setting. It won't accept "third-party cookies" (i.e., cookies from a domain other than what's showing in the address bar). Among other uses, this prevents advertisers from saving tracking cookies for their ads displayed on other sites.
Individual visitors can turn off that setting in their preferences, but you won't be able to skirt around it at your end other than to break out of the frameset.
回答3:
I think that if you add an appropriate P3P Policy then IE will allow the cookies.
I created one using the IBM P3P Policy Editor.
回答4:
Has the hostname/domain name got an underscore in it (i.e. test_site.localdomain)? If so, that could be the problem as IE does some basic validation on the domain name before setting cookies (and therefore remembering the session) and it rejects underscores/underlines in the hostname.
来源:https://stackoverflow.com/questions/1363199/why-is-ie7-rejecting-session-cookies-from-a-page-in-a-frame