473,322 Members | 1,566 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,322 software developers and data experts.

Cookies and Windows

Hi ... here is my situation: I am building an application that is
driven by a main menu. When the user chooses an option from the main
menu that spawns a new window (or module). From that(or any) module
window there is a menu where the user can choose to go to or switch to
any other module. So ... lets say that the main menu has 4 options.
The user chooses option 1 which will open a new window (replacing the
main menu). On that new window there is a menu where the user can
choose another module (which would spawn that module's window) .. and
so forth.

The problem is this: Let's say the user has all 4 modules open and
then chooses from module1 to switch to module2....well that spawns a
new window instead of just giving module2 focus. I have solved a big
portion of this using cookies to let me know if the window is already
open...however, when the user chooses a module window that is already
open then I am having trouble giving that window focus.

Pseudo-code is like this and included in an external .js file that is
loaded by each new page:

if (getCookie(pageID) == "")
{
alert(pageID + ' not open .. will now open');
setCookie(pageID,'1','','','','');
if (pageID=='firstone')
Page1=window.open(page,'','fullscreen');
else if (pageID=='secondone')
Page2=window.open(page,'','fullscreen');
else if (pageID=='thirdone')
Page3=window.open(page,'','fullscreen');
}
else
{
alert(pageID + ' already open .. giving focus');
if (pageID=='firstone')
Page1.focus();
else if (pageID=='secondone')
Page2.focus();
else if (pageID=='thirdone')
Page3.focus();
}

Now this works until it runs into a page that is already loaded and
then tells me that "Page1 is null or not an object". I understand why
this is happening but am not sure how to make the new window objects
accessable to the other windows.

Any help would be greatly appreciated.
Jul 20 '05 #1
1 1297
In article <25**************************@posting.google.com >,
du**********@setel.com enlightened us with...

The problem is this: Let's say the user has all 4 modules open and
then chooses from module1 to switch to module2....well that spawns a
new window instead of just giving module2 focus. I have solved a big
portion of this using cookies to let me know if the window is already
open...however, when the user chooses a module window that is already
open then I am having trouble giving that window focus.


You'd be better off giving the windows handles and checking for those.

This is mine for a help menu.
If the window is open, gives it focus and loads the help screen from an
array that is populated elsewhere in the script. Modify it for your
needs.
Tested for NN6+/IE5+. I can't guarantee it works in any other browser.

<script language="javascript" type="text/javascript">
var h_window = null;

function openHelp(screenName)
{
if (!h_window || h_window == null || typeof h_window == "undefined" ||
h_window.closed || !h_window.document)
h_window = window.open("","Help","height=200,width=
200,scrollbars=yes,resizable=yes");
var doc = h_window.document;
doc.open();
doc.writeln("<html><head><title>Help</title>");
doc.writeln("<link rel='stylesheet' type='text/css'
href='myStylesheet.css'>");
doc.writeln("</head><body>");
doc.writeln(h_array[screenName]);
doc.writeln("</body></html>");
doc.close();
h_window.focus();
return;
}
</script>

--
--
~kaeli~
She was engaged to a boyfriend with a wooden leg but broke
it off.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #2

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

Similar topics

4
by: Brian Burgess | last post by:
Hi all, Anyone know of any special issues with storing cookies with ASP? I'm trying this with two browsers: One is IE 6.0 with cookies set to 'prompt'. This has been working properly as any...
7
by: Brian Burgess | last post by:
Hi all, Anyone see anything wrong with the following: *************************************************************** <%@ LANGUAGE="VBSCRIPT" %> <% Option Explicit Dim nAcctNbr Dim...
2
by: Dan | last post by:
I persist the login info using cookies so that a user doesn't have to login every time they come to our website, unless they previously logged out. Everything works OK on W98 SE, and Windows XP Pro...
2
by: Scott | last post by:
I would like to have my ASPX page call a function intended to make changes the the current Page.Response.Cookies. I had thought that to allow the function to modify the Cookies, I would have top...
6
by: DJones | last post by:
I'm using the following code in my .Net application (.Net v1.1, Windows 2000) to write Session Cookies. HttpContext.Current.Response.Cookies("cookieSession")("SessionID") = strSessionID ...
16
by: Cheung, Jeffrey Jing-Yen | last post by:
I have a windows form application that generates a request, downloads an image, and waits the user to enter in login info. Unfortunately, this image is dynamic and based on session data. I have...
7
by: Marcus | last post by:
I know that when you start a session in PHP, the "cookie" it creates is not the same as those that are stored in your browser's temp folder, and instead is kept in RAM. I am confused because in...
3
by: ramesh.nrk | last post by:
Hi, Is there any way to read the cookies which are in local machine? Can we create cookies using windows Application in the local machine? I am developing a windows application which needs...
3
by: nabira | last post by:
Hi, I've a problem with cookies for MediaWiki. I'm using: - Windows 2000 server machine as server. - Apache 2.0.61 as Web Server. - PHP 5.2.4 In particular, when I try to login from a client I...
7
by: cmrchs | last post by:
Hi, In Windows Vista: where does asp.net write its cookies? I use HttpCookie objCookie = new HttpCookie("nameCookie"); in Win2000 (and later) they used to be in C:\Documents and...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.