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

    1. <small id='T0DD0'></small><noframes id='T0DD0'>

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

        • <bdo id='T0DD0'></bdo><ul id='T0DD0'></ul>
        <tfoot id='T0DD0'></tfoot>
        <legend id='T0DD0'><style id='T0DD0'><dir id='T0DD0'><q id='T0DD0'></q></dir></style></legend>
      1. 存儲 HTML5 地理位置數據

        Storing HTML5 geolocation data(存儲 HTML5 地理位置數據)
                  <tbody id='UyXH6'></tbody>
                  <bdo id='UyXH6'></bdo><ul id='UyXH6'></ul>

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

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

                • <legend id='UyXH6'><style id='UyXH6'><dir id='UyXH6'><q id='UyXH6'></q></dir></style></legend>
                  <tfoot id='UyXH6'></tfoot>

                • 本文介紹了存儲 HTML5 地理位置數據的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  如何在 Rails 3 中存儲和處理網站用戶的地理位置(經緯度),以便它檢查我們是否已經在每個頁面請求的用戶會話中保存了這些詳細信息(如果我們沒有保存詳細信息,那么我們應該從瀏覽器請求用戶的位置,然后將這些詳細信息存儲在會話中)?

                  How can I store and process the geolocation (long and lat) of a website user in Rails 3, so that it checks to see if we're already holding those details in a session for that user on every page request (if we're not holding the details, then we should request the user's location from the browser and then store those details in the session)?

                  推薦答案

                  根據您的要求,我想說您實際上并不需要 ajax,因為大部分處理將使用 JS 完成(詢問用戶訪問他們的位置,解析響應等),我會使用 JS 設置一個 cookie,Rails 會看到).

                  Based on your requirements I'd say that you don't actually need ajax, since most of the processing will be done using JS (to ask the user for access to their location, parse the response etc), I'd use JS to set a cookie, which Rails will then see).

                  在您的控制器中

                  def action
                    @lat_lng = cookies[:lat_lng].split("|")
                  end
                  

                  在你看來

                  <%- unless @lat_lng %>
                  <script>
                    getGeoLocation();
                  </script>
                  <%- end %>
                  

                  在您的一個 javascript 文件中

                  function getGeoLocation() {
                    navigator.geolocation.getCurrentPosition(setGeoCookie);
                  }
                  
                  function setGeoCookie(position) {
                    var cookie_val = position.coords.latitude + "|" + position.coords.longitude;
                    document.cookie = "lat_lng=" + escape(cookie_val);
                  }
                  

                  請注意,上述測試都不是為了查看用戶是否擁有支持地理定位的瀏覽器,或者用戶是否已授予(或拒絕)使用其位置的權限,并且該 cookie 將是一個會話 cookie,并且JS 不會測試是否已經設置了 cookie.要在 cookie 上設置更復雜的信息,請查看 http://www.quirksmode.org/js/cookies.html 有關使用 javascript 的 GeoLocation 的更多信息,請參閱 http://diveintohtml5.info/geolocation.html

                  Note that none of the above tests to see if the user has a browser that supports geolocation, or if the user has granted (or denied) permission to use their location, and that the cookie will be a session cookie, and that the JS doesn't test to see if the cookie is already set. To set more complicated information on the cookie take a look at http://www.quirksmode.org/js/cookies.html For more information on GeoLocation using javascript see http://diveintohtml5.info/geolocation.html

                  這篇關于存儲 HTML5 地理位置數據的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                  相關文檔推薦

                  Angular 2 (Ionic 2): intercept ajax requests(Angular 2 (Ionic 2):攔截 ajax 請求)
                  Angular 2 HTTP Progress bar(Angular 2 HTTP 進度條)
                  Printing from an application in IIS to a networked printer on server(從 IIS 中的應用程序打印到服務器上的網絡打印機)
                  angular2 posting XML type request data using HTTP(angular2 使用 HTTP 發布 XML 類型的請求數據)
                  Rounding Lat and Long to Show Approximate Location in Google Maps(舍入經緯度以在 Google 地圖中顯示大致位置)
                  Event not working on dynamically created element(事件不適用于動態創建的元素)

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

                          <bdo id='kTyig'></bdo><ul id='kTyig'></ul>

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

                          • <legend id='kTyig'><style id='kTyig'><dir id='kTyig'><q id='kTyig'></q></dir></style></legend>
                              <tbody id='kTyig'></tbody>
                            主站蜘蛛池模板: 成人毛片在线视频 | 欧美成人一区二区 | 91在线看网站 | 日韩中文字幕一区二区 | 欧美在线视频网 | 999久久久久久久久 国产欧美在线观看 | 国产色99 | 在线免费观看欧美 | 日韩电影中文字幕 | 99久久精品免费看国产小宝寻花 | 免费午夜视频 | 国产精品视频一二三区 | 精品成人免费视频 | 亚洲91视频| 亚洲高清在线 | 精品综合网 | 久久99精品久久久久久 | 成人亚洲视频 | 国产精品中文字幕在线 | 一区二区三区在线播放 | 免费性视频| 亚洲精品在线视频 | av在线成人 | 国产精品视频一二三区 | 亚洲精品二区 | 欧美色欧美亚洲另类七区 | 精品久久影院 | 韩国主播午夜大尺度福利 | 国产黄色大片 | 中文字幕一区二区三区在线乱码 | wwww.xxxx免费| 我爱操| 黄视频欧美| 99riav国产一区二区三区 | 天天综合网91 | 欧美区日韩区 | 日韩精品一区二区三区中文字幕 | www.日本国产 | 中文字幕视频在线 | 国产91久久久久久 | 欧美一区二不卡视频 |