473,657 Members | 2,294 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Browser script loading method

Hello,
I have a couple of questions regarding the loading of .js files for
the browser and would like anyone to point me wher to find the answer
(or if you know the answer and tell me will do just fine ;) )
- If I have several pages all using 'somejs.js' file this file is
shared on disk and is downloaded only once... but how about in memory,
is it also shared and just loaded once?

-Also, when are the .js files unloaded from memory?

-Can I unload at any given time a .js file from memory?

Thanks in advance

Feb 10 '07 #1
6 2216
er************@ gmail.com said the following on 2/10/2007 10:07 AM:
Hello,
I have a couple of questions regarding the loading of .js files for
the browser and would like anyone to point me wher to find the answer
(or if you know the answer and tell me will do just fine ;) )
- If I have several pages all using 'somejs.js' file this file is
shared on disk and is downloaded only once... but how about in memory,
is it also shared and just loaded once?
Typically, yes. But it depends on user cache settings and cache headers
sent with the file.
-Also, when are the .js files unloaded from memory?
When the page is unloaded.
-Can I unload at any given time a .js file from memory?
Not easily.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javas cript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Feb 10 '07 #2
<er************ @gmail.comwrote :
I have a couple of questions regarding the loading of .js files
for the browser and would like anyone to point me wher to find
the answer (or if you know the answer and tell me will do just
fine ;) ) - If I have several pages all using 'somejs.js' file
this file is shared on disk
There is not much sense in "shared on disk" here. There is no necessary
relationship between a web server's responses to requests and the file
structure on the machine that is running it.
and is downloaded only once...
Presumably that it once per browser connection? However, each page that
references an external JS resource may request that resource anew form
the server. If they don't do so then the implication is that the JS is
cached on the client (which is mostly what would be expected) and
requests are being served from the browser's disc cache
but how about in memory,
is it also shared and just loaded once?
Javascript files are source code, which is used to define an executable
structure. A browser receiving a listing of javascript source code from a
server may store that in its disk cache for use with later requests
(possibly in later sessions), it may also elect to keep the source code
in memory for the current session in anticipation of further requests for
the same source.

For any given HTML page loaded into a browser a SCRIPT element's
reference to an external JS resource will necessitate the fetching of the
source code so that it can be processed into an executable for that
particular page. That source code may be fetched from the browser's
memory, the browser's disk cache, or the network (where it may be found
on an intermediate HTTP cache, or retrieved from the original server).

The executable structures created from the source code belong to the
individual page's representation in the browser. They cannot be shared
between pages displayed in the same browser (frameset frames or different
tabs) because they have a particular scope structure that relates to the
individual page. However, some browsers cache the page's representation,
so if you leave a page and then use the 'back' button to return to it
that representation can be re-used instead of needing to be re-built from
the original (HTML/CSS/JS) source code.
-Also, when are the .js files unloaded from memory?
The unloading of the javascript source files from memory (if they were
stored there more than fleetingly in the first place) is something that
can be left to the browser. The unloading of the executable structures
created from javascript source should follow the destruction of the
browser's representation of the page, which may follow the user's leaving
the page, or may be delayed until the browser is closed down.
-Can I unload at any given time a .js file from memory?
That is not under your control. You may influence the browser's (and the
network's) caching behaviour with appropriate HTTP headers. For example,
if an HTTP header states that a resource will expire in 10 minutes a
client may see no need to keep it in its cache (memory or disk) beyond
that point, as it should not re-use an expired resource.

The executable structures in association with a particular page's
reprehension are subject to javascript's normal garbage collection. If
you remove all references to the referenceable aspects of those
structures from the reprehension then the structures become available for
garbage collection and should be removed from memory at some subsequent
point.

Richard.

Feb 10 '07 #3
On Feb 10, 4:07 pm, ernesto.tej...@ gmail.com wrote:
Hello,
I have a couple of questions regarding the loading of .js files for
the browser and would like anyone to point me wher to find the answer
(or if you know the answer and tell me will do just fine ;) )
- If I have several pages all using 'somejs.js' file this file is
shared on disk and is downloaded only once... but how about in memory,
is it also shared and just loaded once?

-Also, when are the .js files unloaded from memory?

-Can I unload at any given time a .js file from memory?
The replies you got already are very helpful, maybe I can bring my two
cents in making one detail more precise. When the client's browser
"loads" a javascript, it really includes it into the javascript
context of the web page. So, two instances of the same whateverjs.js
loaded by two different pages live independent lives, for instance
their respective global variables will assume independent values. Be
it in javascript or whatever interpreted language with a context that
I know, you can't extract one component which is making part of a
context from that context without deleting that context.

Emmanuel

Feb 10 '07 #4
On Feb 10, 4:39 pm, "Emmanuel" <satim...@gmail .comwrote:
On Feb 10, 4:07 pm, ernesto.tej...@ gmail.com wrote:
Hello,
I have a couple of questions regarding the loading of .js files for
the browser and would like anyone to point me wher to find the answer
(or if you know the answer and tell me will do just fine ;) )
- If I have several pages all using 'somejs.js' file this file is
shared on disk and is downloaded only once... but how about in memory,
is it also shared and just loaded once?
-Also, when are the .js files unloaded from memory?
-Can I unload at any given time a .js file from memory?

The replies you got already are very helpful, maybe I can bring my two
cents in making one detail more precise. When the client's browser
"loads" a javascript, it really includes it into the javascript
context of the web page. So, two instances of the same whateverjs.js
loaded by two different pages live independent lives, for instance
their respective global variables will assume independent values. Be
it in javascript or whatever interpreted language with a context that
I know, you can't extract one component which is making part of a
context from that context without deleting that context.

Emmanuel
Thanks a lot guys that was the kind of answer I needed... could any of
you point me to where I can learn more?.. Books, links or online
articles.

Thanks once more!!

Feb 12 '07 #5
er************@ gmail.com said the following on 2/12/2007 3:34 AM:

<snip>
Thanks a lot guys that was the kind of answer I needed... could any of
you point me to where I can learn more?.. Books, links or online
articles.
You will not find - bar none - a better JS resource than the one you are
posting in now - comp.lang.javas cript and the FAQ for this group. There
simply doesn't exist a better resource.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javas cript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Feb 12 '07 #6
On Feb 12, 12:34 am, ernesto.tej...@ gmail.com wrote:
Thanks a lot guys that was the kind of answer I needed... could any of
you point me to where I can learn more?.. Books, links or online
articles.
I highly recommend http://javascript.crockford.com

--
Isaac Z. Schlueter
http://isaacschlueter.com

Feb 13 '07 #7

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

Similar topics

6
3532
by: bayram guzer | last post by:
hi everybody, i have very strange error. i can not see some of the asp pages on my browser. when i look from view source, all the source is there but browser does not show anything, just an empty page. Does anybody have idea about this ?
2
309
by: david | last post by:
(1) How do I update the IE browser's status bar from within an ASP.NET web application? (2) How can I capture the event of closing the IE browser from within an ASP.NET web application? (3) How can I suspend any activity - disable accepting keyboard or mouse clicks on a web page until the client request is processed by an IIS server.
17
2541
by: lawrence | last post by:
How is it possible that the question "How do I detect which browser the user has" is missing from this FAQ: http://www.faqts.com/knowledge_base/index.phtml/fid/125 and is only here on this with a link to old information that suggests use of "navigator": http://developer.irt.org/script/43.htm
8
2661
by: Ed Jay | last post by:
I want to use history.go() to navigate between my previously loaded pages. I'm looking for a way to trigger a function call when a page is accessed using history.go(). Is there an event generated? Is there a method for detecting what page the user came from when a page is accessed using history.go()? -- Ed Jay (remove M to respond by email)
5
1646
by: tdan | last post by:
When loading Javascript files with <scripttags in your HTML, do the files load AND run sequentially or does the HTML simply load the files and run them simultaneously. If not, how can you force them to run sequentially?
1
1751
by: Kai | last post by:
Hello, everybody, I have a problem which I had never seen before and it only appears on one of our servers. Whenever I load a php-script from the server the browser loads the page and shows it but still shows the progress bar running. This ist very problematic in conjunction with javascript, since the "onLoad"-function won't be called unless the browser "thinks", that he has finished loading. HTML-files are loaded normally in...
0
2760
by: deepakNagpal | last post by:
hi, friends, i got stuck in a problem, where i am not able to load the swf files in the another swf files through xml file, running online in ie browser. 1. There are two button on the stage instanced named (next_btn) and (prev_btn) 2. A movieclip named container_mc. 3. swfs which is to be load in the container_mc here is code for my fla file:
4
6186
by: Quill_Patricia | last post by:
I have a Python script which is used to load data into a database. Up to now this script has been run by customers from the Windows command prompt using "python edg_loader.pyc". Any error messages generated are written to a log file. A project team working in the same company as me here would like to use this loading utility. They write UI applications for Windows using Java. They were able to launch the Python script from within Java by...
0
8407
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
8319
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
8739
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8512
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7347
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...
1
6175
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4171
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
4329
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1732
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.