So were using this third party catalog thing which I don't like much at all. I won't get into all the details of my disliking but for starters it runs in an iframe. Now if a customer is browsing inside this iframe and they find a product they like and attempt to add it to cart it ask's them to (standard behavior) login. Now a modal window login pops up and asks you to login but you're also still inside of the iframe.

After login (still in the iframe) your product is added to the cart and you're logged in but it doesn't show the item in the cart nor does it show that you're logged in because of this dumb iframe not capturing the sessions/caching. So now you close the iframe and are back on the site but you still don't see the item in your cart or that you are logged in until a page refresh or a click on any other link. Now it shows you that you are logged in and with the item you selected while inside the catalog iframe.

Option A: Is there a way to fix this issue so once you login inside the iframe it shows you you're logged in inside the iframe?

Option B: If there is no way to show that you are logged in after logging in inside the iframe can we at least update the website when you close the iframe asynchronously or something so you don't have to refresh the page again or click through to another link?

  • In principle, if you can determine when the user closes the iframe with JavaScript, you can then trigger the mini-cart and other knockout.js driven page elements to update without refreshing the page. The implementation depends on how this iframe actually works.
    – jiheison
    May 21, 2021 at 1:57
  • stackoverflow.com/a/9154267/10014756 This may help to implement Option B May 21, 2021 at 5:02
  • A short question: does the content inside the iframe show any indicators, if a user is logged in and has something in the cart? If so, you could "read" the status of that indicator with javascript and set a session variable inside magento via Ajax. That way, you could set a session variable by yourself.
    – Mario
    May 21, 2021 at 9:19
  • please disable cache and check once whole functionality its works well or not? May 24, 2021 at 3:54
  • We can't just disable cache, that would make the website super slow. @GohilRajesh
    – Head
    Jun 3, 2021 at 22:58

1 Answer 1


If you can overwrite this 3rd party module (and most probably you can), you could post a message from iframe to parent frame using Window.postMessage() after logging the user in or out (see: https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage). Then you could write a JS script somewhere on your page to listen to such message, and either refresh the whole page with Location.reload() (see: https://developer.mozilla.org/pl/docs/Web/API/Location/reload) or try to reinitialize components such as mini-cart, customer links, etc. (but this might be non trivial).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.