Javascript-ie How do I handle cross-domain Cookie invalidation?

Source: Internet
Author: User
A page by JS created an IFRAME called the B page

The cookie on page b in Firefox can be read out on page a

But to the IE 9 is not, how to solve it?

Reply content:

A page by JS created an IFRAME called the B page

The cookie on page b in Firefox can be read out on page a

But to the IE 9 is not, how to solve it?

Based on security, browsers are not allowed to operate across domains (of course, you can set cookies to be shared between sub-domains).

If you want to achieve a full sense of cross-domain operations (any two domain names), it is recommended that the landlord use PostMessage (such as: Http://github.com/daepark/postmessage), it with the help of modern browser window.postmessage , it will use the window location hash polling for browsers that do not support window.postmessage, so browser compatibility is good.

Example:
-Botong recruitment and integration of PHP100 using the Postmessage.js Library (http://bbs.php100.com/job/), Botong Recruitment page through the IFRAME fully integrated into the Php100.com page, two domain names through the postmessage to do some control page height, page jump and other things.

The main requirement is simply that a page requires some data, but the data in other sites, need to find ways to catch.
If it's just your own gadget, it's not compatible with IE.
If you need to consider compatibility, the description is a formal project, generally encountered this cross-domain problem can find back-end classmates to help. Cross-domain security restrictions are for the browser side, there is no cross-domain security restrictions on the server side. Back end has phantomjs such as headless browser and a variety of crawlers can go to other sites to grab data, and then made Ajax interface for you, good happy.

  • Related Article

    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.