As more people start using my app, I’m finding that if the user has Grammarly installed, it is causing Safari to throw a “blocked a frame with origin” error as the user types their credit card into the stripe elements window.
I’m wondering if anyone else has had this issue and if they found a fix for it!
I was thinking I couldn't use that as I don't know the specific HTML element that Stripe will create... but can I just put it on the whole div that Stripe populates then, like this?
<div id="card-element" data-gramm="false">
<!-- Elements will create input elements here -->
</div>
No that wouldn’t work. I believe the name of the form field for the card number is in fact cardnumber so you could use some javascript for this
// Select the Stripe Card Number field
var stripecard = document.getElementsByName("cardnumber")[0].value;
// Disable Grammarly on the field
stripecard.setAttribute('data-gramm', 'false');
Note I haven’t checked this as I do not use Stripe Elements. This will need to be triggered after Stripe.js has been loaded.
That probably won’t work either as you are trying to set an attribute before the fields have been fully rendered in the DOM. I would create these in a separate function and then call it after everything else has loaded.