Several methods of react+django to clear the browser

1. meta method

    The packaged entry index.html header is added 

<META HTTP-EQUIV="pragma" CONTENT="no-cache"> 
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate"> 
<META HTTP-EQUIV="expires" CONTENT="0">

2. How to clean up the form

<body onLoad="javascript:document.yourFormName.reset()">

In fact, the cache of the form form is still helpful for us to write. Generally, it is not recommended to clean it up, but sometimes for security issues, it needs to be cleaned up!

Three. ajax method

$.ajax({
     url:'www.haorooms.com',
     dataType:'json',
     data:{},
     beforeSend :function(xmlHttp){ 
        xmlHttp.setRequestHeader("If-Modified-Since","0"); 
        xmlHttp.setRequestHeader("Cache-Control","no-cache");
     },
     success:function(response){
         //操作
     }
     async:false
  });

Or use cache:false directly

$.ajax({
     url:'www.haorooms.com',
     dataType:'json',
     data:{},
     cache:false, 
     ifModified :true ,

     success:function(response){
         //操作
     }
     async:false
  });

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324725165&siteId=291194637