PHP uses P3P to implement cross-origin. Unlike common methods such as JS Cross-Origin and IFRAME cross-origin, you can also use P3P to implement cross-origin. What is P3P (PlatformforPrivacyPreferences) is a common solution released by W3C that privacy protection is different from JS Cross-Origin and IFRAME cross-origin. It can also be used to implement cross-origin.
What is P3P?
P3P (Platform for Privacy Preferences) is a W3C recommendation standard for Privacy protection, providing users with Privacy protection.
The concept of the P3P standard is: the privacy policy of a Web site should inform the visitor of the type of information collected by the site, who the information will be provided to, how long the information will be retained, and how the information will be used, for example, the website shall make a statement such as "this website will monitor the pages you visit to improve the site usage" or "This website will provide you with more suitable advertisements as much as possible. Users who access the website that supports P3P have the right to view the site privacy report, and then decide whether to accept cookies or use the website.
How to use P3P to implement cross-origin
During development, the cross-domain we encounter is mainly entangled in IE. when IFRAME, FRAME, or JS cross-domain in the page, IE has a security policy to limit that the page does not contain cookies, however, if we add P3P, there is no restriction on this policy. This is also a feasible prerequisite for P3P to break through cross-origin.
The following example is an excerpt:
Http://www.a.com/a_setcookie.php file content:
Http://www.a.com/a_getcookie.php file content:
Http://www. B .com/ B _setcookie.php file content: