I am using an IFrame, and from this IFrame I want to redirect to another page.
Please tell me how to do this without any JavaScript, ie, no window.location
.
Response.Redirect
shows the page in the IFrame, but I want to show page as a main page.
1) click on images link in iframe changes Parent page, click on another iframe image link changes Parent to another page (see below). can you please post the code you're currently using, in addition to the link you provided? You need to name the parent and use the target attribute.
Redirect the page containing your iframe embed The second option would be to redirect the page where you have your iframe embedded, known as the "parent" page. Modern browsers will prevent an iframe from changing the location of its parent page for security reasons.
parent. location. href = "http://www.example.com"; Will redirect the parent iframe.
Once id of iframe is set, you can access iframe from inner document as shown below. var iframe = parent. document. getElementById(frameElement.id);
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With