473,396 Members | 2,139 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,396 software developers and data experts.

Check for existing array from another page

Can I determine if an array of image links is already in memory
without using cookies or a hidden frameset? Scenario: visitor starts
with Home page, images (links) for navigation pre-load no problem.
Visitor follows search engine link and does not land on Home, thus no
links. But if I put the same code on every page to allow for that,
won't the images re-load every time those pages are loaded? If so,
there's be no point in pre-loading.

My approach up to now: I tried to set a variable value at the end of
the pre-load script, and test for it at the begining of the same
script on each page. Thus, no matter where they land, the pre-load
script runs if the value does not exist, and doesn't run if it exists.
Thus on every page the script would be the same, allowing me to use it
as a template. But I cannot figure out how to discover the existence
of the variable value when loading other pages. Using the alert
function tells me it does not exist. Any suggestions (remember, no
framesets or cookies, please)?

One thing that just occurred to me: what if I called the same external
script from each page? Would the variable value be accessible when
navigating from page to page or would it be reset anyway?
Thanks for any help.
Dave
Jul 20 '05 #1
2 3676
Dave wrote:
Can I determine if an array of image links is already in memory
without using cookies or a hidden frameset? Scenario: visitor starts
with Home page, images (links) for navigation pre-load no problem.
Visitor follows search engine link and does not land on Home, thus no
links. But if I put the same code on every page to allow for that,
won't the images re-load every time those pages are loaded? If so,
there's be no point in pre-loading.

...
One thing that just occurred to me: what if I called the same external
script from each page? Would the variable value be accessible when
navigating from page to page or would it be reset anyway?


You cannot share variables between different pages, if I understand the
functionality of your code correctly, this preloads images which are used
in the navigation. The best solution is to include the Javascript code for
preloading these images on every page -- on the first page the images will
get loaded from the server, on subsequent pages they preload will use the
cached images (depending on cache settings, of course).

--
Klaus Johannes Rusch
Kl********@atmedia.net
http://www.atmedia.net/KlausRusch/
Jul 20 '05 #2
Klaus Johannes Rusch <Kl********@atmedia.net> wrote in message news:<3F***************@atmedia.net>...
Dave wrote:
Can I determine if an array of image links is already in memory
without using cookies or a hidden frameset? Scenario: visitor starts
with Home page, images (links) for navigation pre-load no problem.
Visitor follows search engine link and does not land on Home, thus no
links. But if I put the same code on every page to allow for that,
won't the images re-load every time those pages are loaded? If so,
there's be no point in pre-loading.

...
One thing that just occurred to me: what if I called the same external
script from each page? Would the variable value be accessible when
navigating from page to page or would it be reset anyway?


You cannot share variables between different pages, if I understand the
functionality of your code correctly, this preloads images which are used
in the navigation. The best solution is to include the Javascript code for
preloading these images on every page -- on the first page the images will
get loaded from the server, on subsequent pages they preload will use the
cached images (depending on cache settings, of course).


Got hold of a 4th edition copy of Goodman's Javascript Bible before
reading your reply. After an hour or so, I realized global variables
don't have the same connotation in JS as they do in VBA. It seems a
solution (other than your reasonably acceptable one) is to use the
escape function to create an appendage to the new document URL when
loading the next page, and look for the appendage when a page loads.
If it exists, bypass the code. So I tried it. Had it working, but now
I get an error when the function to swap images runs. Seems my array
variable is "undefined". I checked spelling and caps and for the life
of me, I can't see why.

Given that there are four possible settings for browser cache(and I'd
suspect "every visit to page" is default) I lean towards the book
solution at the moment since cache settings are a hit and miss
proposition. Now, if I can only figure out why the error. BTW, it's
probably apparent I'm no JS guru, so if anyone cares to check my
script to solve my error message, I'd be happy to post it.
Thanks.
Jul 20 '05 #3

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

Similar topics

7
by: fr? | last post by:
Hi, i have a website , on wich users have to log in credentials are checked against mysql db some session vars are set during login for use somewhere else in the code. Is there a way to...
27
by: mrbog | last post by:
Tell me if my assertion is wrong here: The only way to prevent session hijacking is to NEVER store authentication information (such as name/password) in the session. Well, to never authenticate...
11
by: Wolfgang Kaml | last post by:
Hello All, I have been working on this for almost a week now and I haven't anything up my sleeves anymore that I could test in addition or change.... Since I am not sure, if this is a Windows...
5
by: Steve Wylie | last post by:
I am constructing an HTML questionnaire and one of the questions requires people to rate some choices from 1 to 5, where 1 is their favourite and 5 is their least favourite: Car Bus Taxi cab...
26
by: JGH | last post by:
How can I check if a key is defined in an associative array? var users = new array(); users = "Joe Blow"; users = "John Doe"; users = "Jane Doe"; function isUser (userID) { if (?????)
6
by: FTSoJ | last post by:
On a file A.c I define the structure T1 typedef struct { int dummy; int age; char lastname ; char firstname; } T1_user; On a file B.c I define a strcuture T2
15
by: Dan DeConinck | last post by:
Hello, I want to save the position of all the controls on my form. I would like to write them out to a preference file. I have done this in DOS BASIC like this: TO WRITE the preference...
5
by: wesley | last post by:
Hi all I have many check boxes on a page (The number is unknown) I want to send the results to another page. I will have to name the checkboxes using an array because i dont know how many check...
17
by: Klaas Vantournhout | last post by:
Hi all, I was wondering if it is possible if you can check in a function if one of the arguments is temporary. What I mean is the following. A is a class, foo is a function returning a class...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.