How do I set cookies from outside domains inside iframes in Safari?

前端 未结 5 1651
梦毁少年i
梦毁少年i 2020-12-08 10:55

From the Apple developer faq

Safari ships with a conservative cookie policy which limits cookie writes to only the pages chosen (\"navigated to\

5条回答
  •  自闭症患者
    2020-12-08 11:15

    This page suggests that you place some javascript in your pages which detects the absence of an always-there cookie. When it finds that the cookie has not been set, it posts the required session data to a page which sets the cookie, and redirects you back to the originating page.

    Apparently the POST is enough to satisfy Safari's 'have I navigated to this domain' test, so from then on it accepts cookies from that domain.

    Of course, it's not the nicest of code, but may well solve your problem.

提交回复
热议问题