久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

      <i id='le5sD'><tr id='le5sD'><dt id='le5sD'><q id='le5sD'><span id='le5sD'><b id='le5sD'><form id='le5sD'><ins id='le5sD'></ins><ul id='le5sD'></ul><sub id='le5sD'></sub></form><legend id='le5sD'></legend><bdo id='le5sD'><pre id='le5sD'><center id='le5sD'></center></pre></bdo></b><th id='le5sD'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='le5sD'><tfoot id='le5sD'></tfoot><dl id='le5sD'><fieldset id='le5sD'></fieldset></dl></div>

        • <bdo id='le5sD'></bdo><ul id='le5sD'></ul>
      1. <legend id='le5sD'><style id='le5sD'><dir id='le5sD'><q id='le5sD'></q></dir></style></legend>

        <small id='le5sD'></small><noframes id='le5sD'>

        <tfoot id='le5sD'></tfoot>
      2. 監控 location.hash 是 XHR 應用中歷史的解決方案嗎

        Is monitoring location.hash a solution for history in XHR apps?(監控 location.hash 是 XHR 應用中歷史的解決方案嗎?)

        <small id='jLSiN'></small><noframes id='jLSiN'>

              <bdo id='jLSiN'></bdo><ul id='jLSiN'></ul>
              <legend id='jLSiN'><style id='jLSiN'><dir id='jLSiN'><q id='jLSiN'></q></dir></style></legend>
                  <tbody id='jLSiN'></tbody>

                1. <i id='jLSiN'><tr id='jLSiN'><dt id='jLSiN'><q id='jLSiN'><span id='jLSiN'><b id='jLSiN'><form id='jLSiN'><ins id='jLSiN'></ins><ul id='jLSiN'></ul><sub id='jLSiN'></sub></form><legend id='jLSiN'></legend><bdo id='jLSiN'><pre id='jLSiN'><center id='jLSiN'></center></pre></bdo></b><th id='jLSiN'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='jLSiN'><tfoot id='jLSiN'></tfoot><dl id='jLSiN'><fieldset id='jLSiN'></fieldset></dl></div>
                2. <tfoot id='jLSiN'></tfoot>
                  本文介紹了監控 location.hash 是 XHR 應用中歷史的解決方案嗎?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  眾所周知,在 XHR(又名 AJAX)Web 應用程序中,不會為您的應用程序構建歷史記錄,并且單擊刷新按鈕通常會使用戶退出他/她當前的活動.我偶然發現了 location.hash(例如 http://anywhere/index.html#somehashvalue)來規避刷新問題(使用 location.hash 通知您的應用程序的當前狀態并使用頁面加載處理程序來重置該狀態).真的很好很簡單.

                  As is well known, in XHR (aka AJAX) web applications no history for your app is build and clicking the refresh button often moves the user out of his/her current activity. I stumbled upon location.hash (e.g. http://anywhere/index.html#somehashvalue) to circumvent the refresh problem (use location.hash to inform your app of it's current state and use a page load handler to reset that state). It's really nice and simple.

                  這讓我想到了使用 location.hash 來跟蹤我的應用程序的歷史記錄.我不想使用現有的庫,因為它們使用 iframe 等.所以這是我的五分錢:當應用程序頁面加載時,我開始這樣做:

                  This brought me to thinking about using location.hash to track the history of my app. I don't want to use existing libraries, because they use iframes etc. So here's my nickel and dime: when the application page loads I start this:

                  setInterval(
                         function(){
                             if (location.hash !== appCache.currentHash) {
                                 appCache.currentHash = location.hash;
                                 appCache.history.push(location.hash);
                                 /* ... [load state using the hash value] ... */
                                 return true;
                             }
                             return false;
                         }, 250
                   );
                  

                  (appCache 是一個包含應用程序變量的預定義對象) 這個想法是從哈希值觸發應用程序中的每個動作.在體面的瀏覽器中,哈希值更改會在歷史記錄中添加一個條目,而在 IE (<= 7) 中則不會.在所有瀏覽器中,向后或向前導航到具有另一個哈希值的頁面不會觸發頁面刷新.這就是間隔函數接管的地方.每次檢測到哈希值更改時(以編程方式,或通過單擊后退或前進),應用程序都可以使用該功能采取適當的措施.應用程序可以跟蹤它自己的歷史記錄,我應該能夠在應用程序中顯示歷史記錄按鈕(尤其是對于 IE 用戶).

                  (appCache is a predefined object containing application variables) The idea is to trigger every action in the application from the hash value. In decent browsers a hash value change adds an entry to the history, in IE (<= 7) it doesn't. In all browsers, navigating back or forward to a page with another hash value doesn't trigger a page refresh. That's where the intervalled function takes over. With the function everytime the hash value change is detected (programmatically, or by clicking back or forward) the app can take appropriate action. The application can keep track of it's own history and I should be able to present history buttons in the application (especially for IE users).

                  據我所知,這可以跨瀏覽器工作,并且在內存或處理器資源方面沒有成本.所以我的問題是:這是否是管理 XHR 應用程序歷史的可行解決方案?有什么好處和壞處?

                  As far as I can tell this works cross browser and there's no cost in terms of memory or processor resources. So my question is: would this be a viable solution to manage the history in XHR-apps? What are the pros and cons?

                  更新:因為我使用自制框架,我不想使用現有框架之一.為了能夠在 IE 中使用 location.hash 并將其保存在歷史記錄中,我創建了一個簡單的腳本(是的,它需要一個 iframe),它可能對您有用.我在我的網站發布了它,請隨意使用/修改/批評它.

                  Update: because I use my homebrew framework, I didn't want to use one of the existing frameworks. To be able to use location.hash in IE and having it in it's history too, I created a simple script (yes, it's needs an iframe) which may be of use to you. I published it on my site, feel free to use/modify/critizise it.

                  推薦答案

                  我認為您將很難知道用戶是前進還是后退.假設 url 開始/myapp#page1 所以你開始跟蹤狀態.然后用戶做一些事情來制作 url/myapp#page2然后用戶做一些事情來再次制作 url/myapp#page1.現在他們的歷史是模棱兩可的,你不知道要刪除什么.

                  I think you'll have a tricky time knowing if a user went forward or back. Say the url starts /myapp#page1 so you start tracking states. Then the user does something to make the url /myapp#page2 Then the user does something to make the url /myapp#page1 again. Now their history is ambiguous and you won't know what to remove or not.

                  歷史框架使用 iframe 來解決您提到的瀏覽器不一致問題.您只需要在需要它們的瀏覽器中使用 iframe.

                  The history frameworks use iframes to get around the browser inconsistencies you mentioned. You only need to use iframes in the browsers that need them.

                  另一個缺點是用戶總是會先選擇瀏覽器的后退按鈕,然后再選擇您的自定義后退按鈕.我感覺每 250 毫秒讀取一次歷史記錄的延遲也會很明顯.也許您可以將間隔做得更緊,但我不知道這是否會使事情表現不佳.

                  Another con is that users will always go for their browsers back button before they will go for your custom back button. I have a feeling the delay on reading the history every 250ms will be noticeable too. Maybe you can do the interval even tighter, but then I don't know if that'll make things perform badly.

                  我使用過 yui 的歷史管理器,雖然它在所有瀏覽器(尤其是 ie6)中并不是一直都能完美運行,但它已經被很多用戶和開發者使用.他們使用的模式也非常靈活.

                  I've used yui's history manager, and although it doesn't work perfectly all the time in all browsers (especially ie6), it's been used by a lot of users and developers. The pattern they use is pretty flexible too.

                  這篇關于監控 location.hash 是 XHR 應用中歷史的解決方案嗎?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Browser waits for ajax call to complete even after abort has been called (jQuery)(即使在調用 abort (jQuery) 之后,瀏覽器也會等待 ajax 調用完成)
                  JavaScript innerHTML is not working for IE?(JavaScript innerHTML 不適用于 IE?)
                  XMLHttpRequest cannot load, No #39;Access-Control-Allow-Origin#39; header is present on the requested resource(XMLHttpRequest 無法加載,請求的資源上不存在“Access-Control-Allow-Origin標頭) - IT屋-程序員軟件開發技術分
                  Is it possible for XHR HEAD requests to not follow redirects (301 302)(XHR HEAD 請求是否有可能不遵循重定向 (301 302))
                  NETWORK_ERROR: XMLHttpRequest Exception 101(NETWORK_ERROR:XMLHttpRequest 異常 101)
                  XMLHttpRequest 206 Partial Content(XMLHttpRequest 206 部分內容)

                  <small id='p6cNH'></small><noframes id='p6cNH'>

                  • <i id='p6cNH'><tr id='p6cNH'><dt id='p6cNH'><q id='p6cNH'><span id='p6cNH'><b id='p6cNH'><form id='p6cNH'><ins id='p6cNH'></ins><ul id='p6cNH'></ul><sub id='p6cNH'></sub></form><legend id='p6cNH'></legend><bdo id='p6cNH'><pre id='p6cNH'><center id='p6cNH'></center></pre></bdo></b><th id='p6cNH'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='p6cNH'><tfoot id='p6cNH'></tfoot><dl id='p6cNH'><fieldset id='p6cNH'></fieldset></dl></div>
                        <legend id='p6cNH'><style id='p6cNH'><dir id='p6cNH'><q id='p6cNH'></q></dir></style></legend>
                          <bdo id='p6cNH'></bdo><ul id='p6cNH'></ul>

                          <tfoot id='p6cNH'></tfoot>
                            <tbody id='p6cNH'></tbody>

                          1. 主站蜘蛛池模板: 天天久久| 久久久久国产一区二区三区 | 伊人久久大香线 | 亚洲自拍一区在线观看 | 日本电影免费完整观看 | 在线观看欧美一区 | 国产日韩欧美精品一区二区三区 | www.47久久青青 | 911网站大全在线观看 | 国产中文字幕网 | 久久久91精品国产一区二区三区 | 国产一区二区三区在线看 | 日韩亚洲视频 | 国产在线观 | 久久久一二三区 | 久久免费高清视频 | 91精品国产欧美一区二区成人 | 最新超碰| 亚洲大片在线观看 | 日韩在线免费视频 | 97影院2| 日本不卡一区二区三区在线观看 | 午夜伦4480yy私人影院 | 欧美精品一区二区三区在线播放 | 五月天婷婷综合 | 国产伦精品一区二区三区高清 | 99婷婷 | 天天干天天爱天天爽 | 日韩精品一区中文字幕 | 97色在线视频 | 国产成人99久久亚洲综合精品 | 久久69精品久久久久久久电影好 | 亚洲精品一区二区网址 | 一区二区三区不卡视频 | 精品国产一二三区 | 伊人网91 | 欧美在线一区二区三区 | 红桃成人在线 | 欧美在线天堂 | 在线成人av | 精品免费国产一区二区三区四区介绍 |