pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

      <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="gyt7k2t" 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. 監(jiān)控 location.hash 是 XHR 應(yīng)用中歷史的解決方案嗎

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

        <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="pv8878a" id='jLSiN'><tfoot id='jLSiN'></tfoot><dl id='jLSiN'><fieldset id='jLSiN'></fieldset></dl></div>
                2. <tfoot id='jLSiN'></tfoot>
                  本文介紹了監(jiān)控 location.hash 是 XHR 應(yīng)用中歷史的解決方案嗎?的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

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

                  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 來跟蹤我的應(yīng)用程序的歷史記錄.我不想使用現(xiàn)有的庫,因?yàn)樗鼈兪褂?iframe 等.所以這是我的五分錢:當(dāng)應(yīng)用程序頁面加載時(shí),我開始這樣做:

                  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 是一個(gè)包含應(yīng)用程序變量的預(yù)定義對(duì)象) 這個(gè)想法是從哈希值觸發(fā)應(yīng)用程序中的每個(gè)動(dòng)作.在體面的瀏覽器中,哈希值更改會(huì)在歷史記錄中添加一個(gè)條目,而在 IE (<= 7) 中則不會(huì).在所有瀏覽器中,向后或向前導(dǎo)航到具有另一個(gè)哈希值的頁面不會(huì)觸發(fā)頁面刷新.這就是間隔函數(shù)接管的地方.每次檢測到哈希值更改時(shí)(以編程方式,或通過單擊后退或前進(jìn)),應(yīng)用程序都可以使用該功能采取適當(dāng)?shù)拇胧?應(yīng)用程序可以跟蹤它自己的歷史記錄,我應(yīng)該能夠在應(yīng)用程序中顯示歷史記錄按鈕(尤其是對(duì)于 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).

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

                  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?

                  更新:因?yàn)槲沂褂米灾瓶蚣埽也幌胧褂矛F(xiàn)有框架之一.為了能夠在 IE 中使用 location.hash 并將其保存在歷史記錄中,我創(chuàng)建了一個(gè)簡單的腳本(是的,它需要一個(gè) iframe),它可能對(duì)您有用.我在我的網(wǎng)站發(fā)布了它,請(qǐng)隨意使用/修改/批評(píng)它.

                  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.

                  推薦答案

                  我認(rèn)為您將很難知道用戶是前進(jìn)還是后退.假設(shè) url 開始/myapp#page1 所以你開始跟蹤狀態(tài).然后用戶做一些事情來制作 url/myapp#page2然后用戶做一些事情來再次制作 url/myapp#page1.現(xiàn)在他們的歷史是模棱兩可的,你不知道要?jiǎng)h除什么.

                  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.

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

                  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)中并不是一直都能完美運(yùn)行,但它已經(jīng)被很多用戶和開發(fā)者使用.他們使用的模式也非常靈活.

                  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.

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

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

                  相關(guān)文檔推薦

                  Browser waits for ajax call to complete even after abort has been called (jQuery)(即使在調(diào)用 abort (jQuery) 之后,瀏覽器也會(huì)等待 ajax 調(diào)用完成)
                  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 無法加載,請(qǐng)求的資源上不存在“Access-Control-Allow-Origin標(biāo)頭) - IT屋-程序員軟件開發(fā)技術(shù)分
                  Is it possible for XHR HEAD requests to not follow redirects (301 302)(XHR HEAD 請(qǐng)求是否有可能不遵循重定向 (301 302))
                  NETWORK_ERROR: XMLHttpRequest Exception 101(NETWORK_ERROR:XMLHttpRequest 異常 101)
                  XMLHttpRequest 206 Partial Content(XMLHttpRequest 206 部分內(nèi)容)

                  <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="iprxpbh" 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. 主站蜘蛛池模板: 东莞韩创-专业绝缘骨架|马达塑胶零件|塑胶电机配件|塑封电机骨架厂家 | 单螺旋速冻机-双螺旋-流态化-隧道式-食品速冻机厂家-广州冰泉制冷 | 无锡网站建设_企业网站定制-网站制作公司-阿凡达网络 | 橡胶接头_橡胶软接头_套管伸缩器_管道伸缩器厂家-巩义市远大供水材料有限公司 | 华中线缆有限公司-电缆厂|电缆厂家|电线电缆厂家 | 一氧化氮泄露报警器,二甲苯浓度超标报警器-郑州汇瑞埔电子技术有限公司 | 武汉印刷厂-不干胶标签印刷厂-武汉不干胶印刷-武汉标签印刷厂-武汉标签制作 - 善进特种标签印刷厂 | 首页-浙江橙树网络技术有限公司 石磨面粉机|石磨面粉机械|石磨面粉机组|石磨面粉成套设备-河南成立粮油机械有限公司 | 心得体会网_心得体会格式范文模板 | PCB厂|线路板厂|深圳线路板厂|软硬结合板厂|电路板生产厂家|线路板|深圳电路板厂家|铝基板厂家|深联电路-专业生产PCB研发制造 | 游泳池设备安装工程_恒温泳池设备_儿童游泳池设备厂家_游泳池水处理设备-东莞市君达泳池设备有限公司 | 鹤壁创新仪器公司-全自动量热仪,定硫仪,煤炭测硫仪,灰熔点测定仪,快速自动测氢仪,工业分析仪,煤质化验仪器 | 石英砂矿石色选机_履带辣椒色选机_X光异物检测机-合肥幼狮光电科技 | 塑钢课桌椅、学生课桌椅、课桌椅厂家-学仕教育设备首页 | 锡膏喷印机-全自动涂覆机厂家-全自动点胶机-视觉点胶机-深圳市博明智控科技有限公司 | 干粉砂浆设备_干混砂浆生产线_腻子粉加工设备_石膏抹灰砂浆生产成套设备厂家_干粉混合设备_砂子烘干机--郑州铭将机械设备有限公司 | 江苏大隆凯科技有限公司 | 写方案网_方案策划方案模板下载 事迹材料_个人事迹名人励志故事 | 电位器_轻触开关_USB连接器_广东精密龙电子科技有限公司 | 杭州标识标牌|文化墙|展厅|导视|户内外广告|发光字|灯箱|铭阳制作公司 - 杭州标识标牌|文化墙|展厅|导视|户内外广告|发光字|灯箱|铭阳制作公司 | 污水/卧式/潜水/钻井/矿用/大型/小型/泥浆泵,价格,参数,型号,厂家 - 安平县鼎千泵业制造厂 | 全自动端子机|刺破式端子压接机|全自动双头沾锡机|全自动插胶壳端子机-东莞市傅氏兄弟机械设备有限公司 | 苹果售后维修点查询,苹果iPhone授权售后维修服务中心 – 修果网 拼装地板,悬浮地板厂家,悬浮式拼装运动地板-石家庄博超地板科技有限公司 | 聚合氯化铝价格_聚合氯化铝厂家_pac絮凝剂-唐达净水官网 | 高压绝缘垫-红色配电房绝缘垫-绿色高压绝缘地毯-上海苏海电气 | 斗式提升机_链式斗提机_带式斗提机厂家无锡市鸿诚输送机械有限公司 | led太阳能路灯厂家价格_风光互补庭院灯_农村市政工程路灯-中山华可路灯品牌 | 十字轴_十字轴万向节_十字轴总成-南京万传机械有限公司 | 水压力传感器_数字压力传感器|佛山一众传感仪器有限公司|首页 | 气动隔膜泵厂家-温州永嘉定远泵阀有限公司 | 清管器,管道清管器,聚氨酯发泡球,清管球 - 承德嘉拓设备 | 木材烘干机,木炭烘干机,纸管/佛香烘干设备-河南蓝天机械制造有限公司 | CCE素质教育博览会 | CCE素博会 | 教育展 | 美育展 | 科教展 | 素质教育展 | 日本细胞免疫疗法_肿瘤免疫治疗_NK细胞疗法 - 免疫密码 | 好杂志网-首页| app开发|app开发公司|小程序开发|物联网开发||北京网站制作|--前潮网络 | 健康管理师报名入口,2025年健康管理师考试时间信息网-网站首页 塑料造粒机「厂家直销」-莱州鑫瑞迪机械有限公司 | 大功率金属激光焊接机价格_不锈钢汽车配件|光纤自动激光焊接机设备-东莞市正信激光科技有限公司 定制奶茶纸杯_定制豆浆杯_广东纸杯厂_[绿保佳]一家专业生产纸杯碗的厂家 | 岩棉切条机厂家_玻璃棉裁条机_水泥基保温板设备-廊坊鹏恒机械 | 深圳富泰鑫五金_五金冲压件加工_五金配件加工_精密零件加工厂 | 苏州西装定制-西服定制厂家-职业装定制厂家-尺品服饰西装定做公司 |