[Javascript] javascript object

Ben Curtis Quixote at LaMancha.org
Tue Aug 7 11:20:57 CDT 2001


>> Also, do objects last when the user enters another page or are they
>> destroyed?
> 
> If a page unloads all JavaScript objects are destroyed. The common
> workaround is to store certain variables in the frameset, if present. If you
> don't have a frameset either you cannot store anything.

Everything that is part of the document object and many other things are
destroyed. If you want to pass a simple string or number, you can try
storing it in the window.name, but then you may get weird target results.

If you are working in an intranet setting with a limited number of browsers
to support, you might have some success storing information in the navigator
object. For example:

var Obj = new Object();
Obj.foo = "Wack";
Obj.bar = "Turtles and wurtles";

navigator.foobar = Obj;

---> user goes to a new page, perhaps even on a different server

alert(navigator.foobar.bar);

alerts: "Turtles and wurtles";


This is far from cross-compatible. I think Netscape on a PC (all version 3
and 4, but not 6), and some IE versions on PC. I don't know of any Mac of
Linux browsers that do this. A very limited technique, but I thought I'd
share.

--
+Ben Curtis
...leveraging synergy right out of the box.









More information about the Javascript mailing list