How to close a lightbox from javascript

This used to work:


Suddenly it stopped working. Have also tried this:


from here:

which also doesn’t work.

I want to programatically close the lightbox which a page is showing on (from that page (which is embedded as an iframe)). The user gets to that lightbox content after clicking a CTA button which specified that a page should be opened in a lightbox.

For anyone else, I solved it with this:


hacky but works.