• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

What does IE 8 Cache?

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ummm, yeah. You don't need all sorts of moving parts to solve this very simple problem.
 
Joe Brown
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which part in particular?
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.

 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic