JavaScript - Cache
Hi i need to make a js programe that will replicate a direct mapped cache. I have been given an array with some random cache data. The programe just has to calculate the hit/miss ratio. Im not asking for the code but just help to get started. I think it will be a very short programme but have no clue where to start.
Would someone tell me what functions i would need? The cache can be decimal or binary. Thanks. Similar TutorialsHi, I have an onclick handler as: onClick="window.open ('test.cgi?action=testfile', 'testframe')" When clicked on the button for the first time, request is sent to webserver and target file for "testfile" action is getting loaded in frame testframe. But when i click for the second time, request is not sent to webserver and the cached entry is getting loaded. This issue is occuring only in IE but not in FF. I went to the cached data in c:\Documents and settings\<user>\...\Temporary Internet Files\ and i'm seeing that targetfile for test.cgi?action=testfile is getting stored and "last accessed" time stamp is updated but the "last checked" value is not getting updated (when ever i click on the button). But no issue is seen when the onclick handler is like below: onClick="document.location='test.cgi?action=testfile' I could not understand what exactly is the issue: Is it with Frames/window.open/Do i have to remove cached entries? etc... Can any one please help me out on how i can proceed with this... Please let me know if i'm not clear with above description. Thanks in advance... I've added a js scroller to a client's website, and they are able to edit the scroller text using a php text editor. The script is in a .txt file that is added to the homepage with a php include. Problem is, the edits don't show up right away, sometimes not until next day. I've had the same problem with Flash players (playlists are .txt files), and occassionally with image files, in both IE and FF. Browser continues to use the old file, even if cache is cleared, unless file is renamed. I've cleared cache, confirmed that the old file is gone, deleted the file entirely from the server, rebooted - pretty much everything. Tried onLoad="refresh()", no effect. Anyone know what causes this, and how to fix it? Hello, I'm not sure if this is the best forum for my question or not, but I'll explain what I'm doing and we'll see. I am trying to make a little easter egg hidden inside a web application and its going great except I'd like to hide my .gif files by changing their file extension to something like .dat instead so it won't be so obvious what they are. Basically all I really want to do is have an html image tag that points to a file who's extension is not gif, but really does contain gif content. (I want to mask the fact that the file is really a gif when looking at it in the directory listing.) So, my idea was I would point the <img src=""> tag's src attribute to a cgi script that could write out a Content-type: image/gif header and return the binary gif data. So, I did this and it worked great, but its really slow. (I output the image multiple times and animate it.) So, I thought I could maybe use Javascript to preload these cgi requests and cache them, but every attempt I've made to do this fails! It's like the browser doesn't want to cache the cgi requests. My method of attempting this was to create Image() objects in javascript and set their src attribute to my cgi script call and then set an onload to keep track of when they were all loaded. That seemed to work fine, but then when I try to display an image with the src tag equal to the cgi location (after they were all loaded) its like it goes and reads the code to pull it down again instead of using a cached copy because its really slow. So, then I thought, hey maybe I could just manually edit the binary content of the gif file (which has an extension like .dat) to also contain Content-type: image/gif\n\n embedded at the front of the file. So, I opened the binary file with a hex editor and inserted that text content at the front... but it didn't work. I had <img src="myfile.dat"/> Is there an easy way to make the browser recognize my gif file even if I don't use a gif extension? If not is there a way to preload and cache cgi responses with Javascript so that they don't keep reloading each time I refer to them? Any other ideas? Thanks.
|