paulnordstrom Posted November 15, 2006 Share Posted November 15, 2006 Hi everyone,I have a login script that sets the window.name (javascript) to test against the querystring throughout the admin pages. The problem is when we have some functionality in a pop-up...the new page has no window.name. If we were to use an ifame to pull in these little functions, would the embeded iframe recognize it's parent's window.name?I realize I could try it to see if it works, but somebody may just know right off the bat and save me some time. So thanks in advance for enabling my lazyness.Paul Link to comment Share on other sites More sharing options...
jesh Posted November 15, 2006 Share Posted November 15, 2006 If you set the window name for the parent window using javascript and you open the child window using window.open(), you should be able to specify a name for the child window and access the parent window's name from within the child window.Here's an example: <html><head><script type="text/javascript">window.name = "TheParent!";function openIt(){ var wnd = window.open("","TheChild","width=300,height=200"); var doc = wnd.document; doc.open(); doc.write("<html><body>"); doc.write("This window is named: <scri" + "pt>document.write(window.name);</scri" + "pt><br />"); doc.write("The parent is named: <scri" + "pt>document.write(window.opener.name);</scri" + "pt><br />"); doc.write("</body></html>"); doc.close();}</script></head><body><a href="#" onclick="openIt();">Open new window</a></body></html> Link to comment Share on other sites More sharing options...
paulnordstrom Posted November 19, 2006 Author Share Posted November 19, 2006 Hey jesh,Thanks for response - the more I got in and looked at the login script, the more I disliked it...I think I'll probably just write a whole new login script using sessions. I think if I'm diligent about expiring my sessions, it wont be too hard on the server. Any way, this application is going on a dedicated server, so I really should be able to use session variables. Do you think theres any value in setting the window name also? Do people ever use window names in login functions?But any way, thank you - I learned something new.Paul Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now