aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes What does IE 8 Cache? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "What does IE 8 Cache?" Watch "What does IE 8 Cache?" New topic
Author

What does IE 8 Cache?

Joe Brown
Greenhorn

Joined: Aug 24, 2009
Posts: 14
Hi

I had real problems with IE 8 recently. What I do in my jquery script is I do a "Get" request to my server to look at the users cookie and determine if they wanted to stay logged in for 30mins or stay logged in for 2 weeks. I then return that amount in milliseconds back.

I do this because my whole site is javascript so what I found was if a user walked away for 30mins and came back and tried to do an action to the server the server would figure out the user was logged out and it would try to redirect the user to my sigin page. The thing was since the request was an ajax request the html code for the login page would be sent back instead and it would render on that page. So if the action they where clicking on was say to change to another ajax enabled Ui Tab. It would render my sign in page it that UI tab and would look nasty.

So I had to come up with a way that the javascript would timeout before the server to avoid this.

This is what I came up with



So I did this in the document rdy part and it would go and find there time and set it as a timeout. Every time they make an ajax request it would clear this timeout and make a new timeout. Now in firefox it works as it should work.

However in IE8 it does not work as it should.

I let my timer time out and it redirected to me to my sign in page. I tried to log in and I was timed out immediately. It is like it stores everything in it cache and once you where timed out once your timed out forever until you clear the cache or close IE 8 up and restart.

So I did some tests

So I logged in and out in IE8 and noted what the time that was being return in the wait variable.




Every single time I did this I got the same number back.

I did the same thing in firefox and got



Every time I logged in I got a different number.

So I made another test using asp.net mvc as the server but you could easily use php if needed. All it has on the server side is a random generator. When I run this code in IE 8 I get the same random number each time when I run it in firefox I get a different number each time(well sometime get the same number but that because it is random).


// javascript



// View(only has the script files)




//Severside code(Controller)


So I figured out that if I wrote my jquery like this




and set cache to false then it would work in IE 8. First I don't like doing this method of writing my ajax requests I rather use "GET", "Post" since it is cleaner.

So now I am wondering what else is being cached when I need to to be a new result every time. Does this caching effect only "Gets" or what?

Like I know browsers cache the actual javascript but I did not know IE 8 went so hard core and cached like the method stuff to. I am now wondering how anything on my site work in IE 8 since now I don't know when I do an ajax request if that is some cached result or something.

Thanks
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Why not just check in the Ajax request if the session has timed out, and if it has, return an appropriate error code to the browser and handle it in the callback?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61764
    
  67

Ummm, yeah. You don't need all sorts of moving parts to solve this very simple problem.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Joe Brown
Greenhorn

Joined: Aug 24, 2009
Posts: 14
David Newton wrote:Why not just check in the Ajax request if the session has timed out, and if it has, return an appropriate error code to the browser and handle it in the callback?


How would I do this?
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Which part in particular?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61764
    
  67

How are you doing it in "normal" requests? I think that you are making this much more complicated than it needs to be, to include the description of what it is that you are trying to achieve.
Joe Brown
Greenhorn

Joined: Aug 24, 2009
Posts: 14
David Newton wrote:Which part in particular?


This part

"Why not just check in the Ajax request if the session has timed out, and if it has, return an appropriate error code to the browser and handle it in the callback?"

I don't know how to check the ajax request if it timed out or not. As far I know it does not think it is timed out. Only the server knows if the server timed out. The Ajax request gets stopped at my authentication on my server and checks if the user is logged. If the user has timed out asp.net mvc automatically tries to send them to my login page which the Ajax takes and tries to render the page inside my jquery ui tabs.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What does IE 8 Cache?