Redirect parent from within iframe without losing session

1,387 views
Skip to first unread message

Berco Beute

unread,
Jan 3, 2009, 11:33:37 AM1/3/09
to Django users
My page shows a (logged in) user an iFrame but when the iframe
redirects the browser after it's done, the session is lost. The
redirecting of the parent (by the iframe) is done as follows:

=========================
<head>
<script type="text/javascript">
function load() {
parent.location.href='http://localhost:8000/somewhere';
}
</script>
</head>
==========================

Is there a way to keep the session alive (e.g. keep the user logged
in)?

Thanks,
2B

Berco Beute

unread,
Jan 4, 2009, 2:35:35 PM1/4/09
to Django users
I'm still searching for a solution for this problem.
Which other forums should I try?

Thanks,
2B

Daniel Roseman

unread,
Jan 4, 2009, 7:15:22 PM1/4/09
to Django users
On Jan 4, 2:35 pm, Berco Beute <cybe...@gmail.com> wrote:
> I'm still searching for a solution for this problem.
> Which other forums should I try?
>
> Thanks,
> 2B
>
This is the right forum, but apparently no-one knows the answer to
your question.

Personally, I can't see how that redirect could be causing a session
to be 'lost'. As long as you stay within the same domain, your session
should remain valid. Are you sure that you are using 'localhost:8000'
as the original address as well as the redirected one? How are you
ascertaining that the session is being lost?
--
DR.

Mark Jones

unread,
Jan 4, 2009, 9:31:12 PM1/4/09
to Django users
are you redirecting to the same port? I think redirection to a
different domain OR port would keep the cookie from getting back to
the server, thus killing your session.

Berco Beute

unread,
Jan 5, 2009, 4:43:11 AM1/5/09
to Django users
The iFrame is from a different domain, which is likely causing the
problem. I can see that the session is lost since the logged in user
is suddenly logged out.

2B

On Jan 5, 1:15 am, Daniel Roseman <roseman.dan...@googlemail.com>
wrote:

Berco Beute

unread,
Jan 5, 2009, 5:57:29 PM1/5/09
to Django users
This one still has me flabbergasted. It may be a browser restriction
(firefox 3), but there is no way I can have the iFrame redirect the
parent page to another page in the same domain (as the previous parent
page) without invalidating the session. Is there maybe another common
solution for iFrames to give back control to the parent page?

2B

bradders

unread,
Jan 7, 2009, 6:04:21 PM1/7/09
to Django users
I am getting a very similar problem when simply going between views
(all within the same domain), so it may be nothing to do with iframes.
I have put in a trace and can see that in some cases you enter the
view with all session variables set and when the session is next saved
all the variables have been cleared.


On Jan 5, 10:57 pm, Berco Beute <cybe...@gmail.com> wrote:
> This one still has me flabbergasted. It may be a browser restriction
> (firefox 3), but there is no way I can have the iFrame redirect the
> parent page to another page in the same domain (as the previous parent
> page) without invalidating thesession. Is there maybe another common
> solution for iFrames to give back control to the parent page?
>
> 2B
>
> On Jan 5, 10:43 am, Berco Beute <cybe...@gmail.com> wrote:
>
> > The iFrame is from a different domain, which is likely causing the
> > problem. I can see that thesessionis lost since the logged in user
Reply all
Reply to author
Forward
0 new messages