Can anyone close the popup generated by the bPopup jQuery plugin from a child iframe?

Well, the story is long, but I hope you can carry with me so that there can be some background of the problem:

I am developing a portal registration section using ASP.NET and doing everything well, I decided to use bPopup from here to load the registration page in the iframe of the calling page (parent page). Now I need a way to close the iframe after successful registration, so from the code of the registration page (nested in the iframe) I tried the Javascript function from the parent, which allows me to do this, here the iframe closure function generated by the plugin:

 function bPopup_close() {
         $(".bClose").closePopup();
     return false;
 }

and here is the code behind the iframe (the function will be called when it is sent):

    ClientScript.RegisterOnSubmitStatement
        (GetType(), "Javascript", "javascript: window.opener.bPopup_close();");

. , Firebug , , , window.opener . , ? ...

, , , - ?

+3
2

, dinbror :)

@fred: , . bPopup?

. , :

closeBPopup() { $().bPopup(). close()}

iframe, :

parent.closeBPopup();

+11

- :

ClientScript.RegisterStartupScript(GetType(), "blah", "< script type = \" text/javascript\ " > bclose(); </script> ", false);

bclose():

    function bclose() {
        parent.$("#popup").bPopup().close();
        return false;
    }
+3

Source: https://habr.com/ru/post/1776263/


All Articles