2013-06-21 4 views
0

jquery 탭 기능을 사용하는 MVC 2 프로젝트가 있습니다. 다음 버전은 jquery 및 탭에 사용됩니다.IE 9에서 캐싱 jquery 탭

JQuery와-1.4.4.min.js jquery.tools.min.js은 1.2.5

나는 각 탭에 양식 컨트롤이 있습니다. (가) 막아, 새로운 정보 페이지에 유지 한 후 IE 9에서, 때 나는 이상한 아무것도 여기에 일이없고, 미세 DB

  • 에 게시됩니다 특정 탭

    1. 에 해당 탭에서 정보를 저장 버튼을 클릭
    2. 다른 탭을 클릭 한 다음 정보가 변경된 탭으로 돌아갈 때. 내 변경 사항을 표시하지 않고 탭이 페이지에 처음로드 될 때 정보를 표시합니다.
    3. 페이지를 새로 고침하면 탭에 올바른 정보가 표시됩니다 (# 3에서 설명한대로 오래된 정보는 아닙니다).

    따라서 캐싱은 탭 클릭 사이의 변경 사항을 유지하지 못합니다. 위 # 3에서 설명한대로 문제를 해결하려면 어떻게해야합니까?

    HTML

    <script type="text/javascript"> 
    
        $(document).ready(function() { 
    
          JSGlobalVars.TabsAjaxCall(''); 
    
         }); 
    </script> 
    
    <div class="inside"> 
          <div class="indentmenu"> 
           <ul class="tabs"> 
            <li><a id="GeneralInfo" href="/ProfileEditor/GeneralInfo?fice=XXXXXX&random=68564868">General Info</a></li> 
            <li><a id="Academics" href="/ProfileEditor/Academics?fice=XXXXXX&random=68564868">Academics</a></li> 
            <li><a id="Admission" href="/ProfileEditor/Admission?fice=XXXXXX&random=68564868">Admission</a></li> 
            <li><a id="CampusLife" href="/ProfileEditor/CampusLife?fice=XXXXXX&random=68564868">Campus Life</a></li> 
            <li><a id="CostAid" href="/ProfileEditor/CostAndAid?fice=XXXXXX&random=68564868">Cost & Aid</a></li> 
            <li><a id="Athletics" href="/ProfileEditor/Athletics?fice=XXXXXX&random=68564868">Athletics</a></li> 
            <li><a id="AutomatedOnlineSearch" href="/ProfileEditor/AutomatedOnlineSearch?fice=XXXXXX&random=68564868">Automated Online Search</a></li> 
           </ul> 
    
          </div> 
          <div class="insideContent"> 
           <div class="panes"> 
            <div style="display: block"> 
            </div> 
           </div> 
          </div> 
         </div> 
         <div class="reset"></div> 
        </div> 
    

    JSGlobalVars 시간 동안

    /* tabs handling*/ 
        //pass tab only on load when displaying a specific tab 
        TabsAjaxCall: function (tabToDisplay) { 
         //$("ul.tabs").tabs("div.panes > div", { effect: 'ajax' }); 
    
         $("ul.tabs").tabs("div.panes > div", { effect: 'ajax', history: true, 
          onBeforeClick: function (event, tabIndex) { 
           var $tabProgress = $("#tabProgress"); 
    
           var $currentTab = $("ul.tabs").children('li').eq(tabIndex).children("a"); 
           jLoaderShow($currentTab); 
    
           var tabPanes = this.getPanes(); 
          }, 
          onClick: function (event, tabIndex) { 
           jLoaderHide(); 
           //to display specific tab on load 
           if (tabToDisplay != "" && typeof tabToDisplay != "undefined") { 
            JSGlobalVars.TabOnLoadIndexPerPassedValue(tabToDisplay); 
            //remove tab, we only need it during load and not on subsequest loads 
            tabToDisplay = ""; 
           } 
           var tabPanes = this.getPanes(); 
          } 
         }); 
        }, 
        TabCurrentRefreshCall: function (currentTabIndex) { 
         if (currentTabIndex == "" || typeof currentTabIndex == "undefined" || currentTabIndex == "undefined" || currentTabIndex <= 0) { 
          JSGlobalVars.TabsAjaxCall(); 
         } else { 
          var $currentTab = $("ul.tabs").children('li').eq(currentTabIndex).children("a"); 
          var id = $currentTab.attr("id"); 
          if (id != "") 
           JSGlobalVars.TabsAjaxCall(id); 
          else { 
           //go the tab index route 
           JSGlobalVars.TabsAjaxCall(); 
           var tabsApi = $("ul.tabs").data("tabs"); 
           tabsApi.click(currentTabIndex); 
          } 
         } 
        }, 
        TabIndexForSelected: function() { 
         var tabsApi = $("ul.tabs").data("tabs"); 
         var currentTabIndex = tabsApi.getIndex(); 
         return currentTabIndex; 
        }, 
        TabOnLoadIndexPerPassedValue: function (myTab) { 
         var tabIndex = ""; 
    
         if (myTab != '' && typeof myTab != "undefined") { 
          var isTabIndex = false; 
          $("ul.tabs").children('li').children("a").each(function (index) { 
           if (myTab.toLowerCase() == $(this).attr("id").toLowerCase()) { 
            tabIndex = index; 
            isTabIndex = true; 
            return; 
           } 
          }); 
          if (isTabIndex) { 
           var tabsApi = $("ul.tabs").data("tabs"); 
           tabsApi.click(tabIndex); 
          } 
         } 
        }, 
        TabOnloadIndexPerHash: function() { 
         var tabIndex = ""; 
         var hash = JSGlobalVars.GetHash(); 
         if (hash != '' && hash != 'undefined') { 
          var isTabIndex = false; 
          $("ul.tabs").children('li').children("a").each(function (index) { 
           if (hash.toLowerCase() == $(this).attr("id").toLowerCase()) { 
            tabIndex = index; 
            isTabIndex = true; 
            return; 
           } 
          }); 
          if (isTabIndex) { 
           var tabsApi = $("ul.tabs").data("tabs"); 
           tabsApi.click(tabIndex); 
          } 
         } 
        }, 
        GetHash: function() { 
         var hash = document.location.hash; 
         if (hash != '') { 
          hash = document.location.hash.substr(1, document.location.hash.length); 
         } 
         return hash; 
        } 
    
  • +0

    문제는 탭을 떠날 때마다 돌아가서 탭의 href에서 페이지를 다시 요청하는 것입니다. IE9는 그 결과를 캐싱합니다. 나는 동적으로로드 된 탭 컨텐트를 사용하지 않을 것입니다. –

    +0

    그렇다면 DB에서 정보를 가져 와서 올바른 정보를 표시해야합니다. 이 섹션은 DB로 구동되며 기능은 탭으로 나뉩니다. –

    +0

    IE가 대신 캐시에서 가져 오는 경우 아닙니다. :) –

    답변

    0

    , 나는 자리에 다음과 지금 노력하고 있습니다 뒀다된다. 랜덤 값의 변경으로 인해 IE 9는 이제 액션을 실행합니다. 나는 여전히 더 나은 해결책을 찾고 있으며 하나 찾은 즉시 업데이트 할 것입니다.

    TabsAjaxCall: function (tabToDisplay, isAppendJsRandom) { 
         //$("ul.tabs").tabs("div.panes > div", { effect: 'ajax' }); 
    
         $("ul.tabs").tabs("div.panes > div", { effect: 'ajax', cache: false, ajaxOptions: { cache: false }, history: true, 
          onBeforeClick: function (event, tabIndex) { 
           var $tabProgress = $("#tabProgress"); 
    
           var $currentTab = $("ul.tabs").children('li').eq(tabIndex).children("a"); 
    
           //IE 9 fix 
           JSGlobalVars.TabsHrefWithJsRandom($currentTab, isAppendJsRandom); 
    
           jLoaderShow($currentTab); 
    
           var tabPanes = this.getPanes(); 
          }, 
          onClick: function (event, tabIndex) { 
           jLoaderHide(); 
           //to display specific tab on load 
           if (tabToDisplay != "" && typeof tabToDisplay != "undefined") { 
            JSGlobalVars.TabOnLoadIndexPerPassedValue(tabToDisplay); 
            //remove tab, we only need it during load and not on subsequest loads 
            tabToDisplay = ""; 
           } 
           var tabPanes = this.getPanes(); 
          } 
         }); 
        }, 
        TabsHrefWithJsRandom: function ($currentTab, isAppendJsRandom) { 
         //ie 9 issue fix 
         if (isAppendJsRandom == "" || typeof isAppendJsRandom == "undefined" || isAppendJsRandom == "undefined" || isAppendJsRandom == null) 
          isAppendJsRandom = false; 
         if (isAppendJsRandom) { 
          var href = $currentTab.attr("href"); 
          var radomVerb = "random"; 
          if (href != '' && href != '#') { 
           var indexRandom = href.indexOf(radomVerb); 
           if (indexRandom > 0) { 
            //remove random 
            href = href.substring(0, indexRandom); 
            //remove last index of & and ? 
            var nAnd = href.charAt(indexRandom - 1); 
            if (nAnd == "&" || nAnd == "?") { 
             href = href.substring(0, href.length - 1); 
            } 
           } 
    
           //get and append random to href 
           var random = Math.random(); 
           if (href.lastIndexOf("?") != -1) 
            href += '&'+ radomVerb + '=' + random; 
           else 
            href += '?'+ radomVerb + '=' + random; 
           $currentTab.attr("href", href); 
          } 
         } 
        },