zoukankan      html  css  js  c++  java
  • 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);
              }
  • 相关阅读:
    JS
    JS
    JS
    CSS
    CSS
    CSS
    NPOI导出自动换行效果
    Httpcookie的简单应用
    前台JS设置Cookies后台读取刚设置的Cookies
    SQL SERVER 如何调试存储过程
  • 原文地址:https://www.cnblogs.com/diligenceday/p/9889436.html
Copyright © 2011-2022 走看看