You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rails 7 Turbo using this gem (stripe-rails) produces Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://js.stripe.com') does not match the recipient window's origin#223
if this gem is install and the Stripe JS is loaded at all, then all page navigations produce this JS error in the console:
(index):1 Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://js.stripe.com') does not match the recipient window's origin
// persist initial stripe iFrame DOM Object across turbo AJAX page requests
let stripeIFrameQuery = 'iframe[src^="https://js.stripe.com"]';
document.addEventListener('turbo:before-render', function (event) {
const stripeIFrame = document.querySelector(stripeIFrameQuery);
const newStripeIFrame = event.detail.newBody.querySelector(stripeIFrameQuery);
if (stripeIFrame && !newStripeIFrame){
event.detail.newBody.appendChild(stripeIFrame)
}
});
I'd recommend either this fix be added directly to this gem or that there be some kind of 3rd gem that glues Turbo and stripe-rails together using the code above.
jasonfb
changed the title
Rails 7 Turbo using this gem produces Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://js.stripe.com') does not match the recipient window's origin
Rails 7 Turbo using this gem (stripe-rails) produces Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://js.stripe.com') does not match the recipient window's originJan 4, 2023
Rails 7 with Turbo enabled interactions
if this gem is install and the Stripe JS is loaded at all, then all page navigations produce this JS error in the console:
(index):1 Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://js.stripe.com') does not match the recipient window's origin
(the error doesn't actually block anything)
also reported here
stripe/react-stripe-js#188
The text was updated successfully, but these errors were encountered: