top.location.href from an Iframe
-
Hi, I'm pretty desperate. I have a page (default.aspx) with an iframe. In the iframe i have two frames. In one of the frames I have a LinkButton that should redirect the top page (default.aspx) I've tried RegisterStartupScript with lots of different Javascripts like: top.location.href='new.aspx' but all is loaded in the iframe... Is this doable? Please, please help!
-
Hi, I'm pretty desperate. I have a page (default.aspx) with an iframe. In the iframe i have two frames. In one of the frames I have a LinkButton that should redirect the top page (default.aspx) I've tried RegisterStartupScript with lots of different Javascripts like: top.location.href='new.aspx' but all is loaded in the iframe... Is this doable? Please, please help!
I actuaklly never tried using a frameset in an iframe, but this is how I think that it works: Using the window.top property inside a frame will reference the frameset, e.g. the contents of the iframe. From there you can use the window.parent property to reference the page containing the iframe. So, this should work:
window.top.parent.location = 'new.aspx';
--- b { font-weight: normal; } -
I actuaklly never tried using a frameset in an iframe, but this is how I think that it works: Using the window.top property inside a frame will reference the frameset, e.g. the contents of the iframe. From there you can use the window.parent property to reference the page containing the iframe. So, this should work:
window.top.parent.location = 'new.aspx';
--- b { font-weight: normal; } -
Actually I got to apologize. I guess I got a little too tired, and didnt get the code in the right eventhandler at first. So top.location.href do work! Thanks anyway Guffa - I'll try your idea also.