Redirect the parent page from IFrame Redirect the parent page from IFrame asp.net asp.net

Redirect the parent page from IFrame


It will be a hazard if we can manipulate other frames/window withou using client-side scripts or user-invoked actions.

Here's a list of alternatives:

Javascript options:

window.top.location.href=theLocation;window.parent.location.href=theLocation;window.top.location.replace(theLocation);

Non-javascript options:

<a href="theLocation" target="_top">Click here to continue</a>  <a href="theLocation" target="_parent">Click here to continue</a>


I used this code.

ClientScript.RegisterStartupScript(GetType(), "Load", "<script type='text/javascript'>window.parent.location.href = '../CentinelError.aspx'; </script>");

And it works.


We can redirect from both server and client side when using Iframe<>

Client side response:

window.parent.location.href="http://yoursite.com"

Server side response:

Response.Write("<script type=text/javascript> window.parent.location.href ='http://yoursite.com' </script>")