473,387 Members | 1,497 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,387 software developers and data experts.

Caching of 'semi' dynamic JavaScript (IIS, ASP, IE6)

Hi

We have a dynamically created javascript menu (from ASP), which is
customised per user (Have already taken all the static code out into
separate cached .js file)

The size of the 'dynamic' menu content can be as much as 10kB, and the
menu typically does not change for the duration of the user's session
- i.e. it would be nice to get the browser to 'cache' this. It is an
Intranet application, and is typically aimed at IE6 clients only.

Have considered the following strategies

1) Cookies - although the last thing I want is the whole menu coming
back to the server on every HTTP request - but would be useful IF
there is e.g. a header option the cookie to 'send' the cookie (Server
-> Browser) without the browser ever sending it back to the server
(but the browser still being able to 'read' the cookie?)

2) Creating 'dynamic' javascript files - i.e. send the output per user
to a mangled .js file (e.g. with a session ID in the filename), into a
cached js file. Would however need to cleanup the files quite
regularly, and giving IUSR file creation access doesn't seem a good
idea. Would then get the browser to include the JS by generating ASP
along the lines of.
<script language="JavaScript"
src="TempScripts/Menu<%=UserSession%>.js"></script>

Is there any other way?

Second Question : Is there any way to get IE to stop sending up the
HTTP REFERER header up to the server (e.g. RegKey) - this is pretty
pointless on an Intranet App (I know there is a way to do in
NetScape).

Thanks in advance

Stuart
Jul 23 '05 #1
5 16500
On 27 Sep 2004 08:06:09 -0700, no***@webmail.co.za (Stuart) wrote:
We have a dynamically created javascript menu (from ASP), which is
customised per user (Have already taken all the static code out into
separate cached .js file)
So why not just make the file fullly cacheable? (either for an hour,
or forever, and invalidate the cache when you on the server know it's
no longer valid by changing the referencing URI.) I'm not sure what's
wrong with this approach, I've certainly used it regularly, without
problems.
Second Question : Is there any way to get IE to stop sending up the
HTTP REFERER header up to the server (e.g. RegKey) - this is pretty
pointless on an Intranet App (I know there is a way to do in
NetScape).


Only by stripping it in the client - why is that relevant to you? If
you're really looking to minimise bandwidth as much as you seem, there
are almost certainly better ways, that would depend on what you're
doing of course.

Cheers,

Jim.
Jul 23 '05 #2
Thanks for the reply Jim

It isn't really a file (yet) - it is dynamically created javascript
from ASP (once per user session). Agreed that would make it fully
cacheable if did write it out once created (but guess would have to
address the security issues below).

The asp creates the script dynamically
for each option in the system
if the current user has access to this menu option, then add it
(via javascript)
next
then also add in user's own shortcuts / preferences etc.

Re : Referrer : Bandwidth is at a premium here - have ~30 users coming
over a 256kbps pipe. Agreed that javascript window.location type links
do hide the referrer, but still have tons of "A HREF" type links which
would otherwise have to change. Would be nice to have some kind of
server header or browser regkey setting which just suppressed IE's
referrer header.

Cheers

Stuart
ji*@jibbering.com (Jim Ley) wrote in message news:<41***************@news.individual.net>...
On 27 Sep 2004 08:06:09 -0700, no***@webmail.co.za (Stuart) wrote:
We have a dynamically created javascript menu (from ASP), which is
customised per user (Have already taken all the static code out into
separate cached .js file)


So why not just make the file fullly cacheable? (either for an hour,
or forever, and invalidate the cache when you on the server know it's
no longer valid by changing the referencing URI.) I'm not sure what's
wrong with this approach, I've certainly used it regularly, without
problems.
Second Question : Is there any way to get IE to stop sending up the
HTTP REFERER header up to the server (e.g. RegKey) - this is pretty
pointless on an Intranet App (I know there is a way to do in
NetScape).


Only by stripping it in the client - why is that relevant to you? If
you're really looking to minimise bandwidth as much as you seem, there
are almost certainly better ways, that would depend on what you're
doing of course.

Cheers,

Jim.

Jul 23 '05 #3
On 28 Sep 2004 00:18:43 -0700, no***@webmail.co.za (Stuart) wrote:
Thanks for the reply Jim

It isn't really a file (yet) - it is dynamically created javascript
from ASP (once per user session). Agreed that would make it fully
cacheable if did write it out once created (but guess would have to
address the security issues below).
No need to write it out to a file to make it cacheable, just add a few
headers and have your ASP check for an IF_MODIFIED_SINCE header, and
an ETAG and only return the data if it's too old, it's only a few
lines or so of ASP.
Re : Referrer : Bandwidth is at a premium here - have ~30 users coming
over a 256kbps pipe.


Minimising requests, ensuring good http 1.1 pipelining (make sure
you've got content-lengths on all your dynamic stuff) using gzip
compression etc. will all be the places to go before you start looking
at knocking 50 bytes out of the request.

Jim.
Jul 23 '05 #4
Thanks Jim

Did eventually actually write out to a file & does work a treat - this
was easy nuff to do & will clean these up nightly.

Re : Referrer : Yup, already using PipeBoost for compression (but this
is Server -> Browser).

Noted that the referer header is being passed on each .js Include it
processes on the page (even if the server comes back with NOT
MODIFIED) 20 such includes x 60 bytes = 1200 bytes, from browser ->
Server, which isn't compressed.

Guess will have to live with REFERER's then.

Cheers

Stuart
Jul 23 '05 #5
On 29 Sep 2004 05:37:43 -0700, no***@webmail.co.za (Stuart) wrote:
Noted that the referer header is being passed on each .js Include it
processes on the page (even if the server comes back with NOT
MODIFIED) 20 such includes x 60 bytes = 1200 bytes, from browser ->
Server, which isn't compressed.


Remember not to look at simple number of bytes, bandwidth usage is not
as simple as that. - once you've got a packet going it doesn't matter
full of useful bytes or not. an HTTP request fits in one packet
generally, and the referrer won't change this..

Jim.
Jul 23 '05 #6

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

Similar topics

6
by: Mr WZ Boson | last post by:
Hello, I hope you can help - I'm a bit new to PHP. My basic problem is with a page (HTML) which is intended to display an image slideshow. On this page there are a number of links to click...
7
by: jhomp ssens | last post by:
I would like to create a pulldown menu which is semi-transparent....that is, you can see the text and graphics behind it when it is pulled down. The effect I'm looking for can be seen at...
13
by: tshad | last post by:
How do we handle Caching in IE? It seems that my system works fine in Mozilla and Netscape when I make changes. But in IE the changes are not brought across when someone has been to the site...
2
by: Oberon | last post by:
Why does this not work as it should? I expect index.aspx to show:. Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\inetpub\wwwroot\ChatSimple\db\chatusers.mdb Instead, I get: ...
28
by: Peter Michaux | last post by:
Hi, I'm playing with dynamic script insertion to make a request to the server for a JavaScript file to be automatically run when it arrives in the browser. It works but... The page caching...
3
polymorphic
by: polymorphic | last post by:
I have succeeded in embedding PDF files in a dynamic iframe. The problem is that I need the PDF to cache. If the PDF remains the same from page load to page load then the pdf is somehow cached with...
2
by: mark4asp | last post by:
Can I force the client to stop caching old stylesheets and javascript? In my dynamic web-site, I need to force the client to stop caching old versions of my stylesheets and javascript. Can I do...
6
by: Roderik | last post by:
Hi, On my website I implemented tooltip alike layers when you hover the category items in the sidebar on the right. See: http://www.roderik.net/ The layers that become visible have a...
12
by: =?Utf-8?B?RGF2ZQ==?= | last post by:
I'm using ASP.Net with an UpdatePanel. When the screen is exercised via a Web Test, the Web Test shows that the AJAX scripts are downloaded for every partial post back. My impression was that...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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,...

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.