Total members 11895 |It is currently Sat Dec 21, 2024 6:17 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





Hi ,
If you are facing a problem with caching in internet explorer and your ajax application .

You can add the following code in your jsp file :

Code:
response.setHeader("Cache-Control", "no-cache");

and in your javascript url
Code:
    var url="UI/RoomDetailsView.jsp?ignoreMe=" + new Date().getTime();


Or in php
Code:
<?php header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");  


have fun, :n_clap:



_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time

hi! is this code working? where in particular can i apply the javascript url and the response.setHeader("Cache-Control", "no-cache")?

thank you.. this is my ajax code by the way, maybe you can help me out here where to put the code since i am still a newbie for ajax.

var XMLHttpRequestObject = false;
if (window.XMLHttpRequest)

{
XMLHttpRequestObject = new XMLHttpRequest();
}

else if (window.ActiveXObject)
{
XMLHttpRequestObject = new
ActiveXObject("Microsoft.XMLHTTP");
}

function getData(dataSource, divID)
{
if(XMLHttpRequestObject) {

var obj = document.getElementById(divID);

XMLHttpRequestObject.open("GET", dataSource, true);

XMLHttpRequestObject.onreadystatechange = function()
{
if (XMLHttpRequestObject.readyState == 4 &&
XMLHttpRequestObject.status == 200) {

obj.innerHTML = XMLHttpRequestObject.responseText;
}
}

XMLHttpRequestObject.send(null);
}
}


Author:
Newbie
User avatar Posts: 1
Have thanks: 0 time

hi,

some of the code mentioned above is for the server script that recieves the ajax. Unfortunately its the server that gives the headers, so where ever you url in ajx is pointing to you have to place those headers.

response.setHeader(..... i think is for jsp scripts (on the recieving server)
and header("..... i for php scripts (on the recieving server).

having a look at your code, you should probably have a look at using jQuery javascript framework. Its as 100% cross browser support as your going to get.

if you use jquery the code is as simple as:
$.getJSON('http://some.place.com',{
var1:'this is var',
var2:'this is var2'
},myCallbackFuncion);

and it will work where ever ANY browser supports ajax.

hope this helps


Author:
Newbie
User avatar Posts: 1
Have thanks: 1 time

For this message the author coombesy has received gratitude : DrRakha

Can you show a little example, please?


Author:
Newbie
User avatar Posts: 1
Have thanks: 0 time

Just wrote a blog on this exact issue only using ExtJS ( http://thecodeabode.blogspot.com/2010/10/cache-busting-ajax-requests-in-ie.html)

aside from forcing the Pragma: nocache header, you can add additional query string params the the requested url. The article gives examples on how to do this using POST params via javascript


Author:
Newbie
User avatar Posts: 1
Have thanks: 0 time
Post new topic Reply to topic  [ 5 posts ] 

  Related Posts  to : Solution to AJax Cache problem with Internet Explorer
 Datepicker issue with Internet Explorer     -  
 check if the client is Miscrosoft Internet Explorer     -  
 Solution to Error status zero when using Ajax with JQuery     -  
 Strange Problem with Internet Browsers and Permissions     -  
 using cache extension with php     -  
 What is AJAX, How to start AJAX?     -  
 solution of question     -  
 Solution Architect- Wireless     -  
 Poseidon Infosoft: One Stop Solution for all your IT needs.     -  
 Poseidon Infosoft: One Stop Solution for all your IT needs.     -  



Topic Tags

AJAX Browser
cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com