Source (detailed): http://www.cnblogs.com/artech/archive/2013/01/03/cache-4-ie.html
Solution 1: solve the problem by adding a suffix to the URL address
<! Doctype html > < Html > < Head > < Script Type = "Text/JavaScript" > $ ( Function () {Window. setinterval ( Function () {$. Ajax ({URL: ' @ URL. Action ("getcurrenttime ")? ' + New Date (). totimestring (), success: Function (Result) {$ ( " Ul " ). Append ( " <Li> " + Result + " </LI> " );}});}, 5000 );}); </ Script > </ Head > </ Html >
Solution 2: solve the problem through Ajax settings of jquery
<! Doctype html > < Html > < Head > < Script Type = "Text/JavaScript" > $ ( Function () {$. Ajaxsetup ({cache: False }); Window. setinterval ( Function () {$. Ajax ({URL: ' @ URL. Action ("getcurrenttime ") ' , Success: Function (Result) {$ ( " Ul " ). Append ( " <Li> " + Result + " </LI> " );}});}, 5000 );}); </ Script > </ Head > </ Html >
Solution 3: Use MVC to solve problems through custom response
Public Class Homecontroller: controller { Public Actionresult index (){ Return View ();} [nocache] Public String Getcurrenttime (){ Return Datetime. Now. tolongtimestring ();}} Public Class Nocacheattribute: filterattribute, iactionfilter { Public Void Onactionexecuted (actionexecutedcontext filtercontext) {filtercontext. httpcontext. response. cache. setcacheability (httpcacheability. nocache );} Public Void Onactionexecuting (actionexecutingcontext filtercontext ){}}