Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using dropin leaves iframe in body behind #43

Closed
satazor opened this issue May 5, 2015 · 6 comments
Closed

Using dropin leaves iframe in body behind #43

satazor opened this issue May 5, 2015 · 6 comments

Comments

@satazor
Copy link

satazor commented May 5, 2015

Hi,

I'm using the dropin widget in a modal dialog. The issue is that if the modal is closed, an "iframe" is left behind in the document.body. I searched for a destroy or dispose method in the component but couldn't find none. At the moment I'm removing the iframe manually, but it doesn't feel right.

Am I missing something? Thanks in advance.

@kyledetella
Copy link

@satazor the iframe that contains the modal does not get destroyed since the "inline" iframe may still have to invoke it at another point in the lifecycle.

In the future we are looking to add better lifecycle management including reset and/or destroy methods.

@satazor
Copy link
Author

satazor commented May 5, 2015

The inline iframe gets removed when the modal is closed since it is a descendant of the modal element. So I think it will never get called nor reused since another call to .setup will create another iframe in the body.

As an intermediate solution until those methods are available, is it acceptable to remove the outer iframe manually?

@kyledetella
Copy link

@satazor I am a bit confused. The inline frame and the modal iframe are separate DOM nodes in the document. The inline is not part of the modal frame. The inline frame is the what contains these two views (depending on your state):

screenshot 2015-05-06 07 22 36
screenshot 2015-05-06 07 22 55

So we never remove it since you either use it to enter a card or change your selected payment method. Could you shed some more light on your situation? When are you seeing the inline get removed?

@satazor
Copy link
Author

satazor commented May 6, 2015

Sorry, forget everything that I've said before. I will try to explain in a more clearer way.

The web app we are using braintree is baboom. This is a single page app, so don't expect refreshes to happen very often. We have several stuff that can be bought and when trying to do so, it will trigger the buy process that occurs in a modal dialog, similar to bootstrap modals. This modal has nothing to do with braintrees iframes yet.

In that modal, the product is presented to the user as well as a "proceed to buy" button which instantiates the braintree dropin widget inside the modal. The braintree widget creates an inline iframe inside the modal as well as a iframe in the body. The problem is that when the modal is closed by the user, the inline iframe gets automatically destroyed (because its a descendant of the modal) but the iframe in the body remains. I was expecting to call a destroy method or similar in braintree but none is available.

Hope this is clearer now. If needed I can send you some screenshots to your email. Thank you.

@tnunes
Copy link

tnunes commented May 19, 2015

👍

@kyledetella
Copy link

@satazor as you may have seen in issue #29, we recently introduced an update to braintree.js that will allow you to tear down your integration and setup a new one. This functionality is supported as of version 2.14.0.

By calling teardown, we will cleanup your integration and remove things like iFrames that we created.

Let us know if you run into any further issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants