Caching Of 'semi' Dynamic JavaScript (IIS, ASP, IE6)
Jul 23, 2005
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).
I'm not having this issue with Mozilla Firefox, but it seems that the results of the code below are being cached in EI 8. When the browser makes another asynchronous call to the server with different results from the database, those results are not being displaying on the wepage. How do I fix this problem. As I mentioned above the code works fine in Mozilla Firefox. The page displays data in EI 8 with no errors five seconds after the page has loaded, but as the information in the database changes, I'm not seeing those changes reflected on the page in 5 second intervals.
function reload2(){ $.get( 'vcci.php', function($xml) { // Make the XML query-able with jQuery $xml = $($xml); var $iso2 = $xml.find('data').text(); //alert($iso2); $('#para').text($iso2); }, 'xml' );}
I have a oc4j application server hosting my application . I can see from tcp monitor for eg: GET /scripts/main.js and the server responds with last-modified timestamp. However for subsequent request IE does not use if-modified-since and further for each script in Local Settings is getting cached as main[1].js, main[2].js etc and also in different directories. This does not happen for all script but if a page has some 15 scripts included the last 5 scripts show this behaviour.
Can anyone help figure out why my javascript preloaders aren't preloading! Code:
the navigation section utilses simple js rollovers on the text options, with the onMouseRollover event loading an additional graphic image to the right of the menu. It appears almost instantaneously on broadband, but as I'm testing it on 56k and I'm trying to appease all users I required the navigation images to preload (especially those giving the description of the option).
They appear to preload fine in Netscape7 but not in IE6???
I won't list the entire source here apart from the following sections:: Code:
I'm currently using this method to refer to my JavaScript files:
<script type="text/javascript" src="filename.js"></script> While doing work for some clients I have made changes to the the JavaScript file referenced above. Because their browser has cached it, they end up getting errors on the page unless they hard refresh and get the new version of the file.
Is there anyway to make the JavaScript file come down fresh if it has been modified since the last download?
I am having difficulties with my code and i've tried many ways to do everything from do while to if else statements. i've got everything in my code down but that pesky loop statement, and i'm trying to write my code where it says if one of either of variable Orbital Period or Semi-Major Axis is a zero, then it should use different way to read the inputed information.
i have been tasked to create a web page that includes a fading background. (It must become semi transparent once the page has loaded,and remain until a new page is selected. I want to use a similar concept to: [URL]. However instead of fading out to black, i need it to fade out to white (between 10-15% image opacity). I would also need a similar central, transparent, scrollable frame/div (where each page will load up within and like the above link,i need a different background image to each page.
For a college assignment, i have been tasked to create a web page that includes a fading background. (It must become semi transparent once the page has loaded,and remain until a new page is selected. I want to use a similar concept [URL]. However instead of fading out to black, i need it to fade out to white (between 10-15% image opacity).
I would also need a similar central, transparent, scrollable frame/div (where each page will load up within and like the above link,i need a different background image to each page.
Can I control the src attribute of a header <script> tag so that it loads a different script file depending on the value of a variable?
I have a javascript file that currently holds the variables for several countries and weihgts too much for a single file. I estimate that only 2-3kb of the 40+ that it now holds are used at any given point depending on the user's chosen country.
Now, I can split the file into several smaller files to reduce loading time but only if I have a way of dynamically loading the different files.
If I use javascript to 'read' and XML file does that mean that the XML file gets downloaded to the user's cache?
I'm building a quiz and I'd rather not have the answers too easily available. I believe there's no real way to secure anything client side with javascript so I'm just trying to keep the curious at bay.
I have this dynamically created table in my one of my php forms that shows the names of the people the user has entered into a text field. When they hit add a row displays, showing the name they entered. Also, an image that allows them to delete shows beside the name upon creation.
The delete removes the name from the table and pushes the other names to the top. Simple stuff, however, if I delete the last name displayed(the bottom of the table), then the next, then the next, IN ORDER, I have no problems. If I pick a name that is in the middle or top of the table, everything below does not allow me to delete Code:
I'm developing a webpage that is composed by several divs. These divs are supplied by the server depending on the user that made the request. Some of these divs require some javascript functions to be called when they are added to the page. I add the content using innerHTML (function renderPage(data) ....
What I get in IE is the "YO!" written to the iframe. What I get in Firefox is the 404 not found page of the site where the original "jstest.html" page and script are hosted.
I need to dynamically add elements to a form using javascript. The objective is that on clicking a certain button , a set of form fields are appended to the exiting ones. Code:
In a JSP page I am trying to disable a Trade Class drop-down list if the user does not select the ADULT option of the Division drop-down list.
Therefore, Trade Class drop-down list availability depends on the option selected in the Division drop-down list. For instance, if the user selects the KIDS division option then the Trade Class drop-down list should be disable.
I am trying to use JavaScript to do this but I can't get it to work. I have the OnClick attribute in the Division drop-down list so that when a user selects any option from the list the index gets past to the JavaScript function. In my drop-down Division ADULT has index 1.
function enableDisableTradeClass( ) { var index = document.frm_container_shipments.drp_division_fltr.selectedIndex; //alert('Selected Division= ' + index); if ( index != 1 ) { document.frm_steps.drp_trade_class_fltr.value = ""; document.frm_steps.drp_trade_class_fltr.selectedIndex = 0; }}
I know very little javascript and need to use it to pt a banner across a page, where it is pulling from values a customer puts in the backend.Here is the javascript: Code:
I had an incident in which I uploaded a swf file with an incorrect URL. Well, when I noticed the issue I uploaded a 'new' file - but those who have previously seen the site kept seeing this "older .swf".Without a huge proces. renaming files, modifying html files etc.. Is there a way to customize a meta tag or some other mechanism to have a '.swf' file NOT CACHE. It has to not cache in all browsers.. ala: ie, ff, safari
i have some pictures in a page. there are have difference sizes. some of them are too widen for be arrange in a line. so i been tried to adject their sizes to more suitable.
i add a event to that image likes: <img id="img" onLoad="adjustSize(this)" src="123.jpg">
and write a function in javascript: function adjustSize(obj){ if (obj.width>250){ sizeRate=250/obj.width; obj.width=obj.width*sizeRate; if (obj.hight>268) obj.hight=268; }}
but exactly,i can get the image's width and height. cuz the loading hasn't finished while the function of adjustSize works.
I would like to build an HTML page that has four content areas. The first with 3 links that when clicked chage what is shown in the other 3 - and so changing the default content in these sections. The content for these sections will be contained in seperate HTML files sitting on the same server.
I understand this can be done without refreshing the page and believe JavaScript and Ajax is the best method to do this. Any advice?
Question: How hard is the following to do in javascript and does anyone have a good example of this in use (aka how do you do it? )
4 drop down boxes all on one page. I have 4 items in the list of the first drop down box.
Red Blue Green Orange
When I select one, I want the choice to be taken out of the list for the second drop down box. So if I select Blue in Drop Down #1, Drop Down #2 now has the option of
Red Green Orange
If I select Red from the list the Drop Down #3 now has
Green Orange
Then if i select Orange, the last drop down has only one value and that is Green.
I have a form that has been dynamically created from PHP. It is basically a calculator and the number of form elements as well as names of the elements can vary greatly.
I basically want to add a button that will open a new browser window with the form info being passed to it. Basically it will create a quotation for the customer that is suitable for printing.
The only way I know to do the popup window is with javascript (unless php can do it). I know how to access form elements with javascript if the form element exists, but given most of the elements may change, I do not know how to access them.
I'm sure some wizard will tell me this is a classic example of "piece of cake"; in which case I bow and promise to listen In case I've struck granite rock, feel free to throw questions my way and I'll tell you if I've tried it or not.
I have a file, main.php (I know this is the JS-forum, bear with me). It outputs HTML and inline Javascript functions. When the user clicks on a graphical "tab", that tab is activated, and an ajax call is made to fetch.php with some specific parameters. Once the ajax request has completed, a given innerHTML container on the now active tab is filled with the stuff that fetch.php outputs.
So far so good.
The problem is that the stuff that fetch.php outputs is partial pure HTML and partial inline javascript. And this is where it gets tricky. If I declare an inline javascript function in the returned data, Firefox (and I suspect MSIE) refuses to understand that the function is there. It simply doesn't exist (!).
Using the Web Developer add-on for Firefox, there's an option to look at "Source code" and "Generated source code". The output from these two differ in that when I view the "Generated source code", I see the dynamically inserted javascript/HTML from fetch.php, whereas viewing "just" the source doesn't.
What did I do wrong? How do I get the browser to find/accept/activate the javascript code/functions that were inserted dynamically? I cannot put them in a .js file and include it, since they need to be dynamically created, and I cannot use eval() since that executes javascript "as is", in which a function will not be executed unless called.
I'm passing the asp parameters using the url current page is files.asp and I'm using window.location.href=files.asp?action=deletefile to pass the action to the serverside
My code never got executed (like the page was cached) unless i put document.write("") before the window.location directive.
Here's the code:
function confirmDelete(x){ var potvrda=confirm("Kliknite OK za brisanje. Cancel za povratak."); if (potvrda==true) { trans="files.asp?action="+x; document.write("") window.location.href=trans; } else {} }