[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Few Random thoughts



SilverThorn wrote:
> I wonder if a JS could read a page already loaded in a window?

You can do something like this if your JavaScript code has a "handle" to 
reference the window by, for example, if the window was opened using 
window.open() and you have a saved copy of the returned value from the 
open.

> This could be useful because you could use a dummy page that contained
> a stable database of information available to other pages while
> avoiding the volatile cookie specs.

Yes, I've done something like this for a JavaScript-based slide 
presentation project I'm working on.  I use an HTML document to store 
references (i.e., URLs) to the "slides" (i.e., Web pages) as regular 
links on a page, and then pick the URLs up in my JavaScript code; I also 
store slide titles as hidden variables on a form on the same page.

The one problem you have to watch out for is if the page gets reloaded; 
at 2.0 this screws up references to the variables on the page.  The 
workaround is to "copy" information off the page, e.g., for strings 
you'd do something like

   x = "" + y;

where "x" is your own variable and "y" is a reference to a variable on 
the original page.

Frank

-- 
Frank Hecker          Pre-sales tech support, Netscape Federal sales
hecker@netscape.com   http://home.netscape.com/people/hecker/

--------------------------------------------------------------------
This message came from the mailing list javascript. For help using the
mailing list software, please send a message to 'majordomo@obscure.org'
with the message body 'help'. To unsubscribe, send a message to
'majordomo@obscure.org' with the message body 'unsubscribe javascript'.