iqiyi__youku__cookie_设置

 

iqiyi设置cookie

 

       var string = "此处替换iqiyi的cookie";
          var getCookie = function( str) {
              var cookieArr = str.split(";");
              if(cookieArr == "") return ;
              var result = {};
              for(var i=0; i<cookieArr.length; i++) {
                  cookieArr[i] = cookieArr[i].trim();
                  var key = cookieArr[i].split("=")[0].trim();
                  var value = cookieArr[i].substr(key.length+1).trim();
                  result[key] = value;
              };
              return result;
          }
          var setCookie = function(key, value, day) {
              var date = new Date();
              date.setDate(date.getDate() + day);
              document.cookie = key+"="+value+"; expires="+date.toGMTString()+"; path=/" + "; domain=.iqiyi.com";
          }
          var oldCookies = getCookie(string);
          //removeOld-cookie;
          for(var p in oldCookies) {
              setCookie(p, oldCookies[p], -40);
          }

          var cookies = getCookie(string);
          for(var p in cookies) {
              setCookie(p, cookies[p], 40);
          }

 

youku cookie设置:

       var string = "此处替换youku网cookie";
          var getCookie = function( str) {
              var cookieArr = str.split(";");
              if(cookieArr == "") return ;
              var result = {};
              for(var i=0; i<cookieArr.length; i++) {
                  cookieArr[i] = cookieArr[i].trim();
                  var key = cookieArr[i].split("=")[0].trim();
                  var value = cookieArr[i].substr(key.length+1).trim();
                  result[key] = value;
              };
              return result;
          }
          var setCookie = function(key, value, day) {
              var date = new Date();
              date.setDate(date.getDate() + day);
              document.cookie = key+"="+value+"; expires="+date.toGMTString()+"; path=/" + "; domain=.youku.com";
          }
          var oldCookies = getCookie(string);
          //removeOld-cookie;
          for(var p in oldCookies) {
              setCookie(p, oldCookies[p], -40);
          }

          var cookies = getCookie(string);
          for(var p in cookies) {
              setCookie(p, cookies[p], 40);
          }

 

posted @ 2018-11-04 21:49 方方和圆圆 阅读(...) 评论(...) 编辑 收藏

再过一百年, 我会在哪里?