Julien Cheyssial's Blog

It's all about a nice UI

<December 2008>
SuMoTuWeThFrSa
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910


Navigation

Books I'm reading

My Articles

Subscriptions

Post Categories



Expand your login pages !

Here's a small javascript code snippet that checks if the page is nested in a frameset, and if so, reloads the entire page (reseting the frameset) so that the page takes up all the space of the browser. Typically, I use this trick for login pages : assume that a user wants to display the default page of an application, which uses a frameset (with 2 frames for example). If the user isn't authenticated, the login page will be displayed twice, one in each frame. To avoid this, just use this little javascript function :

function expandToTop() {
if ((top == null) || (top == self))
    return;
top.location.href = location.href;
}

Just make a call to the expandToTop() function in the onload event of the body of your login page and that's it !

posted on Monday, December 01, 2003 7:33 AM by jcheyssial





Powered by Dot Net Junkies, by Telligent Systems