#mustafa-stripejs-load
1 messages · Page 1 of 1 (latest)
hello! you can async load Stripe.js with the defer attribute: https://stripe.com/docs/js/including
Complete reference documentation for the Stripe JavaScript SDK.
Thank you so much! I'll have a read.
Can I disturb you again if I get stuck...? I'm not a pro dev...
I see the <script src="https://js.stripe.com/v3/"></script>
I assume this will eventually change to v4? In which case I'd have to update the script with the defer attribute, yes?
It shouldn't change to v4, not without requiring a significant change to your integration
so you can keep v3 for now and assume it won't change for years (and if it does, your whole integration would change by that point, if we release a new version of Stripe.js, it would mean lots of breaking changes for your frontend to handle)
np!
One final question.... I currently use <link rel="preconnect" href="https://js.stripe.com/v3/">
That improved the speed a bit... Is it good practice to use this + the script with the defer attribute?
the preconnect seems to have a better impact...
I'll be honest, I haven't used preconnect before but if it works for you to improve loading, I'd say use it