473,385 Members | 1,655 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

how to redirect parent page from iframe page_load?

Hi, I'm having a similar issue as the poster Mike whose message I copied
below... I have a page with an iframe... when I discover that the session
state is no longer valid in the page inside the iframe, I want to redirect
the parent page to a login page. Can anyone help me?

Thanks,
Sheryl
"MLibby" <ml****@nospam.nospam> wrote in message
news:<07**********************************@microso ft.com>...
How can an IFrame's aspx page force a server-side redirect on its parent
page? Typically, an IFrame's client-side javascript specifies '_top' to
change the parent page... window.open('default.aspx?SMID=18', '_top', '', false);
However, the server-side Redirect doesn't include '_top'. I tried to
write the following from server-side code hoping it would execute
immediatly at the client but it won't fire, I'm not sure why:
Response.Write("<script
language=javascript>window.open('default.aspx?SMID =18', '_top', '',
false);</script>");

Please let me know if you have any ideas and thanks in advance for any
help, Mike

Nov 19 '05 #1
2 7344
Stick this at the top of all your non-iframe pages and
call it in the body onload event.

If your page in an iframe attempts to redirect to one of
the non-frame pages, it will break out of the iframe.

function TimeOutRedirect()
{

try
{
if (self.parent.frames.length != 0)
self.parent.location=document.location;
}
catch (Exception) {}

}

--
2005 Microsoft MVP C#
Robbe Morris
http://www.robbemorris.com
http://www.masterado.net/home/listings.aspx

"Sheryl Landon" <sh****@comcast.net> wrote in message
news:ep**************@TK2MSFTNGP12.phx.gbl...
Hi, I'm having a similar issue as the poster Mike whose message I copied
below... I have a page with an iframe... when I discover that the session
state is no longer valid in the page inside the iframe, I want to redirect
the parent page to a login page. Can anyone help me?

Thanks,
Sheryl
"MLibby" <ml****@nospam.nospam> wrote in message
news:<07**********************************@microso ft.com>...
How can an IFrame's aspx page force a server-side redirect on its parent
page? Typically, an IFrame's client-side javascript specifies '_top' to
change the parent page...

window.open('default.aspx?SMID=18', '_top', '', false);

> However, the server-side Redirect doesn't include '_top'. I tried to
> write the following from server-side code hoping it would execute
> immediatly at the client but it won't fire, I'm not sure why:
> Response.Write("<script
> language=javascript>window.open('default.aspx?SMID =18', '_top', '',
> false);</script>");

Please let me know if you have any ideas and thanks in advance for any
help,

Mike


Nov 19 '05 #2
Hey, that's way cool! the first thing I've seen that worked in my
situation! And I've tried quite a few "solutions" out there! Thanks!

"Robbe Morris [C# MVP]" <in**@turnkeytools.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
Stick this at the top of all your non-iframe pages and
call it in the body onload event.

If your page in an iframe attempts to redirect to one of
the non-frame pages, it will break out of the iframe.

function TimeOutRedirect()
{

try
{
if (self.parent.frames.length != 0)
self.parent.location=document.location;
}
catch (Exception) {}

}

--
2005 Microsoft MVP C#
Robbe Morris
http://www.robbemorris.com
http://www.masterado.net/home/listings.aspx

"Sheryl Landon" <sh****@comcast.net> wrote in message
news:ep**************@TK2MSFTNGP12.phx.gbl...
Hi, I'm having a similar issue as the poster Mike whose message I copied
below... I have a page with an iframe... when I discover that the session
state is no longer valid in the page inside the iframe, I want to
redirect the parent page to a login page. Can anyone help me?

Thanks,
Sheryl
"MLibby" <ml****@nospam.nospam> wrote in message
news:<07**********************************@microso ft.com>...
How can an IFrame's aspx page force a server-side redirect on its parent
page? Typically, an IFrame's client-side javascript specifies '_top' to
change the parent page...

window.open('default.aspx?SMID=18', '_top', '', false);

> However, the server-side Redirect doesn't include '_top'. I tried to
> write the following from server-side code hoping it would execute
> immediatly at the client but it won't fire, I'm not sure why:
> Response.Write("<script
> language=javascript>window.open('default.aspx?SMID =18', '_top', '',
> false);</script>");

Please let me know if you have any ideas and thanks in advance for any
help,

Mike



Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: sentinel | last post by:
I am using this code to redirect to another page <body> <script language="javascript"> window.location="index2.php?ui=0&ua=0&opt=forum" </script> </body>
1
by: David P. Donahue | last post by:
I have a page that's viewed within an Iframe. This page has some code behind it, including a reference to another class in the project which, depending on certain conditions, may perform a...
2
by: Jeronimo Bertran | last post by:
Hi, I have a page with a very data intensive grid which needs to be automatically refreshed constantly if a change is detected. In order to not refresh the complete page so often, I created an...
1
by: Tom Jackson | last post by:
My aspx login page is in a iframe on another page. After successful login, I want to redirect the parent/top/iframe_containing page. How do I get the response object for the containing html page?...
2
by: MLibby | last post by:
How can an IFrame's aspx page force a server-side redirect on its parent page? Typically, an IFrame's client-side javascript specifies '_top' to change the parent page... ...
0
by: lydia sista via .NET 247 | last post by:
Hi! I'm quite new to asp.net. I just want to ask: how to redirect 2 iframes in the parent on a click? Is there any way to do this? For example my index.htm has 3 iframe: top, main, bottom I...
7
by: =?Utf-8?B?YWxiZXJ0b3Nvcmlh?= | last post by:
Hi everybody, I'm using a system.timers.timer object like this: Dim aTimer As New System.Timers.Timer() In my page_load event I use this: aTimer.Interval = 5000 aTimer.Enabled = True...
0
by: Bali | last post by:
Default.aspx is the starting page containing a control(ascx) which has asp:button control on it. On the button click event it has to open a new page as a modal control. Since refreshing a page in...
1
by: Bali | last post by:
Default.aspx is the starting page containing a control(ascx) which has asp:button control on it. On the button click event it has to open a new page as a modal control. Since refreshing a page in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.