locked
IE cache issue not relead the page RRS feed

  • Question

  • User-1952516322 posted

    Hello,

    I'm facing an issue with IE, and found many subjects but none of them solved my problems.

    If I set the setting of IE to be "Check for newer versions of stored pages: Every time I visit the webpage" it will working, but I need the same thing on client browser.

    how can I force IE to reload the new version of page every time user loggin by javascript or jquery code?

    Thursday, June 4, 2020 2:08 PM

Answers

  • User475983607 posted

    Set the AJAX cache property to false . 

    $.ajax({
        url: 'MyApplication/GetDocuments',
        type: 'GET',
        cache: false,

    AJAX documentation documentation.

    https://api.jquery.com/jquery.ajax/

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, June 5, 2020 12:44 AM

All replies

  • User475983607 posted

    Hello,

    I'm facing an issue with IE, and found many subjects but none of them solved my problems.

    If I set the setting of IE to be "Check for newer versions of stored pages: Every time I visit the webpage" it will working, but I need the same thing on client browser.

    how can I force IE to reload the new version of page every time user loggin by javascript or jquery code?

    You can do this with JavaScript/jQuery by selecting all the anchor tags on the page and appending the current date time to the URL.  But this only works from generated on your site.  It does not work if users bookmarked URLs.

    Thursday, June 4, 2020 2:50 PM
  • User-1952516322 posted

    Dear mgebhard,

    Thanks for your reply, I want to know how can I do it if I'm facing below case:

    I have a XView.cshtml, inside this view I'm calling a method name "GetDocuments" that will call an ajax, the method exist in "MyScript.js" file... in the chrome, no issue every time ajax will call the codeBehind and get the documents... but in IE it will call the ajax only one time, after that even will not call it.

    <script type="text/javascript" src="~/scripts/MyScript.js"></script>
    <script>
    //This is in XView.cshtml
    // Example id = 5;
    LoadDocuments(id)
    </script>
    
    
    
    // MyScript.js
    
    function LoadDocuments(x){
    $.ajax({
            url: 'MyApplication/GetDocuments',
            type: 'GET',
            data: {
                'appId': x
            },
            async: false,
            success: function (partialView) {
                $('#divId').html(partialView);
            },
            error: function (erorr) {
                console.log(erorr);
            }
        });
    }
    
    
    
    

    I put breakpoint in codebehind,, in the chrome, each time you will call method, browser see the codebehind and will get partial view and render it.

    But in IE, only one time, after that I see the compiler in javascript run the method and the ajax, but not see codebehind [Breakpoint not run] which means browser not see the new data.

    Please help.. best regards.

    Friday, June 5, 2020 12:19 AM
  • User475983607 posted

    Set the AJAX cache property to false . 

    $.ajax({
        url: 'MyApplication/GetDocuments',
        type: 'GET',
        cache: false,

    AJAX documentation documentation.

    https://api.jquery.com/jquery.ajax/

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, June 5, 2020 12:44 AM
  • User-1952516322 posted

    Dear mgebhard,

    BEST Regards... and thanks a lot ,, it is working fine.

    Friday, June 5, 2020 6:25 AM