Tanalis has asked for the wisdom of the Perl Monks concerning the following question:

Monks,

I'm writing a quick script to handle user logons and log offs, and would like to change the location of more than one frame on a web page when a logoff occurs (hence I can't just use HTML's TARGET flag. The page has a series of frames, most significant being menu and main, both of which need changing when a logout occurs.

Does anyone know of a quick way to achieve this? I'm already using CGI.pm - not that I can see any way to do this in the CPAN docs. This is the last obstacle I have before the script can be released - hence any help would be appreciated.

Cheers and thanks ..
--Foxcub

Replies are listed 'Best First'.
Re: Changing the location of a different frame with CGI
by dws (Chancellor) on Nov 30, 2002 at 18:08 UTC
    I ... would like to change the location of more than one frame on a web page when a logoff occurs.

    There are two ways to do this.

    1. Reload the entire page, producing revised frame contents when you do, or
    2. Use JavaScript to reach out and reload other frames (by changing their location.href properties).

    Of these, the first is the safest.

      It's also interesting to note that the second option triggers some particularly unfortunate browser behaviour. I worked on an extranet application once where this was done and it turns out that the browsers back button would undo exactly *one* assignment to the location.href properties. The net effect was that the users had to click back three> times to go back one actual page. It was ugly and I wish that on no one.

      Summary: follow dws first suggestion or suffer the consequences. Meohahaha! (ok so I've got a super-kitty villan flick on right now, sue me)

      __SIG__ use B; printf "You are here %08x\n", unpack "L!", unpack "P4", pack "L!", B::svref_2object(sub{})->OUTSIDE;