How PHP uses P3P to implement cross-domain _ PHP Tutorial

Source: Internet
Author: User
Tags ip number
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:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.