473,769 Members | 2,120 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(page ID) == "")
{
alert(pageID + ' not open .. will now open');
setCookie(pageI D,'1','','','', '');
if (pageID=='first one')
Page1=window.op en(page,'','ful lscreen');
else if (pageID=='secon done')
Page2=window.op en(page,'','ful lscreen');
else if (pageID=='third one')
Page3=window.op en(page,'','ful lscreen');
}
else
{
alert(pageID + ' already open .. giving focus');
if (pageID=='first one')
Page1.focus();
else if (pageID=='secon done')
Page2.focus();
else if (pageID=='third one')
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 1340
In article <25************ **************@ posting.google. com>,
du**********@se tel.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="javas cript" type="text/javascript">
var h_window = null;

function openHelp(screen Name)
{
if (!h_window || h_window == null || typeof h_window == "undefined" ||
h_window.closed || !h_window.docum ent)
h_window = window.open("", "Help","height= 200,width=
200,scrollbars= yes,resizable=y es");
var doc = h_window.docume nt;
doc.open();
doc.writeln("<h tml><head><titl e>Help</title>");
doc.writeln("<l ink rel='stylesheet ' type='text/css'
href='myStylesh eet.css'>");
doc.writeln("</head><body>");
doc.writeln(h_a rray[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
3884
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 new site I goto seems to prompt me to store their cookie. The other is Pocket IE on Pocket PC 2002, with the cookies set to 'enabled'. My problem is that the cookies dont seem to be being written with my ASP. I dont get the prompt to store...
7
2997
by: Brian Burgess | last post by:
Hi all, Anyone see anything wrong with the following: *************************************************************** <%@ LANGUAGE="VBSCRIPT" %> <% Option Explicit Dim nAcctNbr Dim nMsgStart
2
3093
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 machines. On a W2K machine, IE6.0.2800.1106 SP1, the following function won't delete cookies, or deletes them but they're mysterioulsy re-created when the web page is subsequently referenced. Therefore, a web user can't logout. //...
2
2486
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 pass the collection by REFERENCE. But I am getting "A property or indexer may not be passed as an out or ref parameter" Here is a simple example of what I am trying to do...
6
3666
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 HttpContext.Current.Response.Cookies("cookieSession")("Site_ID") = strSite_ID
16
11056
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 read documents on the CookieCollection property of HttpWebRequest. Currently, I have the functionality in my code to be able to accept cookies, and return them upon a new HttpWebRequest; however, upon further inspection of the returning...
7
2019
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 every session tutorial I have ever read, the author invariably mentions the 2 main ways of propagating sessions - through cookies and appended to the URL. The author also almost always talks about the method being dependent on the user's...
3
5814
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 to Read the available cookies in the Local Machine, and it has to create cookies in the Local Machine.
3
4516
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 can't do it. I have an error message like this: "Logon Error: Access to my_web_site needs cookies been enabled in your browser".
7
10207
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 Settings\Administrator\Cookies but not anymore
0
9579
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9422
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10208
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8867
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6662
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5294
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5444
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3952
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2812
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.