最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Trying to start an Apple Pay session from a document with an different security origin than its top-level frame - S

programmeradmin0浏览0评论

Problem:

I have ApplePay on my website (), it works and successefull pay.

Now I try to integrate IFrame (src=";) in subdomain () with form, which contains apple pay and get an error

Trying to start an Apple Pay session from a document with an different security origin than its top-level frame

Both sites used Https.

Main domain (with and without www) and subdomain verified in apple developer account.

Problem:

I have ApplePay on my website (https://www.example./order), it works and successefull pay.

Now I try to integrate IFrame (src="https://www.example./order") in subdomain (https://sub.example.) with form, which contains apple pay and get an error

Trying to start an Apple Pay session from a document with an different security origin than its top-level frame

Both sites used Https.

Main domain (with and without www) and subdomain verified in apple developer account.

Share Improve this question asked Sep 4, 2020 at 10:26 Evgeniy LenskiyEvgeniy Lenskiy 4082 gold badges5 silver badges12 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 3

This error can be found in the webkit source

if (!ancestorDocument->securityOrigin().isSameSchemeHostPort(topOrigin))
    return Exception { InvalidAccessError, "Trying to start an Apple Pay session from a document with an different security origin than its top-level frame." };
}

isSameSchemeHostPort function checks that the protocol, domain and port of the iframe and page are the same

return a.protocol == b.protocol
    && a.host == b.host
    && a.port == b.port

As a result, the protocol, domain, and port of the frame and page must be the same to integrate iframe with ApplePay.

This just got fixed in https://github./WebKit/WebKit/pull/11485.

Once this fix is in, the allow attribute's domain config should be respected - eg. <iframe src="https://payment.example" allow="payment 'self'" /> should work now if the iframe is embedded into parent document hosted on a different domain, eg. https://host.example.

You can't use Frames with Apple Pay as it is considered bad practice

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论