[RESOLVED]Login Using iframe and opening landing page in parent window

Hi all,

I want to open a website in iframe which is in div on click of a button on parent page

and as the user submits the button on iframe popup after providing the credentials 

the pop up should close and landing page should be opened in the parent window

Following is the code which is popping the iframe

<script type="text/javascript">
$(function () {
$(‘#<%=btnclick.ClientID%>’).click(function () {
$("#popupdiv").dialog({
// title: "jQuery Popup from Server Side",
width: 430,
height: 250,
// ,
// modal: true,
// buttons: {
// Close: function () {
// $(this).dialog(‘close’);
// }
// }
});
return false;
});
})

</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<div id="popupdiv" title="Basic modal dialog" style="display: none">
<iframe frameborder="0" width="900" height="500" src="http://gmail.com">

</iframe>
</div>
<table align="center" style="margin-top: 200px">
<tr>
<td>
<asp:Button ID="btnclick" runat="server" Text="Show Modal Popup" />
</td>
</tr>
</table>
</div>
</form>
</body>

Hi ronnyrunatserver,

Thanks for your post.

ronnyrunatserver

the pop up should close and landing page should be opened in the parent window

As for your problem, if you’d like to open a page in parent window after closing popup, you could try the following code.

<script type="text/javascript">
    $(function () {
        $('#<%=btnclick.ClientID%>').click(function () {
            $("#popupdiv").dialog({
                title: "jQuery Popup from Server Side",
                width: 430,
                height: 250,
                modal: true,
                buttons: {
                    Close: function () {
                        $(this).dialog('close');
                        window.parent.location("landingpage.aspx");
                    }
                }
            });
            return false;
        });
    })
</script> 

Hope it will be helpful to you.

Best Regards,

Fei Han

Leave a Reply