tyler-johnson / stripe-meteor

A Meteor package containing Stripe.js, Node-Stripe, and Stripe Checkout.
https://atmospherejs.com/mrgalaxy/stripe
150 stars 44 forks source link

Stripe Running on All Pages #41

Open Kickball opened 9 years ago

Kickball commented 9 years ago

Currently when stripe is installed as a package it is loaded on all pages for the site.

Is there a way to manually set which pages stripe is loaded on?

It is causing 400 ms of extra latency per page load.

stolinski commented 8 years ago

I have the same issue. Just noticed that in my Network tab this morning. Would really prefer to manually set when the script is loaded.

MendelYev commented 8 years ago

I fixed it with this pull request : https://github.com/tyler-johnson/stripe-meteor/pull/43

oliverlloyd commented 8 years ago

+1 Because the tag is in the head it blocks the page and Stripe can sometimes take several seconds to serve the request.

joejeet commented 8 years ago

+1

elie222 commented 8 years ago

+1

oliverlloyd commented 8 years ago

With 1.3 it's easy to load stripe on the server using Npm so then all this package is doing is editing the head to load stripe.js & checkout.js. If you want to bring one or both of these calls into a particular template and have control over when and how they load you can use something like $.getScript() inside the onRendered() callback. See: https://forums.meteor.com/t/how-to-load-stripe-js-only-for-the-pages-where-its-used/21286/13