Govind Malviya
Govind Malviya

Reputation: 13753

How can set location of parent from pop up window opened by iframe.

I want to set location of parent window from pop up window opened by iframe.

I am writing this line of code in javascript but it is not working.

window.opener.parent.location = '../Account/';

Upvotes: 6

Views: 9019

Answers (3)

Mircea Soaica
Mircea Soaica

Reputation: 2817

Should work with

window.parent.location.href = '../account/';

Upvotes: 1

Wasim Karani
Wasim Karani

Reputation: 8886

try some thing like this

<b>iframe starts here</b><br><br>
<iframe src='iframe1.html'></iframe>

<br><br>
<b>iframe ends here</b>

<script type="text/javascript">
    function change_parent_url(url)
    {
    document.location=url;
    }       
</script>

In iframe

<a href="javascript:parent.change_parent_url('http://yahoo.com');">
Click here to change parent URL </a>

So you can see that child iframe calls parent's function and gives URL

Upvotes: 0

Pa.M
Pa.M

Reputation: 1402

try

window.opener.parent.location.href = '../account/';

Upvotes: 5

Related Questions