<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                #cookie,localstrorage,sesstionStorage的區別和用法 ##1、各種儲存方案對比‘ * Cookie 瀏覽器均支持,容量為4KB * LocalStorage SesstionStorage HTML5, 容量大約為5M,各個瀏覽器有差異 ## 2 cookie w3c的例子 function getCookie(c_name){ if (document.cookie.length>0){ c_start=document.cookie.indexOf(c_name + "=") if (c_start!=-1){ c_start=c_start + c_name.length+1 c_end=document.cookie.indexOf(";",c_start) if (c_end==-1) c_end=document.cookie.length return unescape(document.cookie.substring(c_start,c_end)) } } return ""; } function setCookie(c_name,value,expiredays){ var exdate=new Date() exdate.setDate(exdate.getDate()+expiredays) document.cookie=c_name+ "=" +escape(value)+ ((expiredays==null) ? "" : "; expires="+exdate.toUTCString()) } function checkCookie(){ username=getCookie('username') if(username!=null && username!=""){alert('Welcome again '+username+'!')} else{ username=prompt('Please enter your name:',"") if (username!=null && username!=""){ setCookie('username',username,355) } } } * escape/unescape 被 encode /decode 取代 * document.cookie的屬性 expires屬性 指定了coolie的生存期,默認情況下coolie是暫時存在的,他們存儲的值只在瀏覽器會話期間存在,當用戶推出瀏覽器后這些值也會丟失,如果想讓cookie存在一段時間,就要為expires屬性設置為未來的一個過期日期。現在已經被max-age屬性所取代,max-age用秒來設置cookie的生存期。 path屬性 它指定與cookie關聯在一起的網頁。在默認的情況下cookie會與創建它的網頁,該網頁處于同一目錄下的網頁以及與這個網頁所在目錄下的子目錄下的網頁關聯。 domain屬性 domain屬性可以使多個web服務器共享cookie。domain屬性的默認值是創建cookie的網頁所在服務器的主機名。不能將一個cookie的域設置成服務器所在的域之外的域。例如讓位于order.damonare.cn的服務器能夠讀取catalog.damonare.cn設置的cookie值。如果catalog.damonare.cn的頁面創建的cookie把自己的path屬性設置為“/”,把domain屬性設置成“.damonare.cn”,那么所有位于catalog.damonare.cn的網頁和所有位于orlders.damonare.cn的網頁,以及位于damonare.cn域的其他服務器上的網頁都可以訪問這個cookie。 secure屬性 它是一個布爾值,指定在網絡上如何傳輸cookie,默認是不安全的,通過一個普通的http連接傳輸 * Cookie和Session 的區別: 1)cookie數據存放在客戶的瀏覽器上,session數據放在服務器上。 2)cookie不是很安全,別人可以分析存放在本地的cookie并進行cookie欺騙,考慮到安全應當使用session。 3)session會在一定時間內保存在服務器上。當訪問增多,會比較占用你服務器的性能考慮到減輕服務器性能方面,應當使用cookie。 4)單個cookie保存的數據不能超過4K,很多瀏覽器都限制一個站點最多保存20個cookie。 5)所以建議: 將登陸信息等重要信息存放為SESSION 其他信息如果需要保留,可以放在cookie中
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看