Quelltext der Datei: http://www.michaelster.ch/jsTestFolder/cookie.htm

Dateigrösse: 2.33 kb

[Anzeige ohne Zeilennummern]


1 
<!DOCTYPE html>
<html lang="de">
  <head>
    <meta charset="utf-8">
        <title>Analysis Statistics</title>
      <!-- https://codepen.io/larrygeams/pen/pdchG -->
  <style>
    *     { padding: 0; margin: 0; }
    @font-face {
      font-family: 'Lato';
      font-style: normal;
      font-weight: 900;
      src: local('Lato Bold'), local('Lato-Bold'), url(http://themes.googleusercontent.com/static/fonts/lato/v6/wkfQbvfT_02e2IWO3yYueQ.woff) format('woff');
    }
    body { margin:2em; background: palevioletred; font-size: 150%; font-family: 'Lato', sans-serif; }
    h2     { font-variant: small-caps !important; }
    pre  { display: inline; font-family: monospace; white-space: nowrap; }
    ol     { list-style-type: square; padding: 15px; display: inline-block; }
    li     { border: 0px dotted white; padding: 15px 10px; }
    li:before    { content: "♛ ♜ ♟"; color: yellow; font-size: 200%; }
    li:after    { content: "♞ ♝ ♚"; color: yellow; font-size: 200%; }
    li:focus, li:hover { color: white !important; }
    li:hover:after, li:hover:before { color: black; }
  </style>
  
  
  <script>
  
  Cookie = {
    get: function (cname) {
      var name = cname + "=";
      var ca = document.cookie.split(";");
      for(var i = 0; i < ca.length; i++) {
        var c = ca[i];
        while (c.charAt(0) == ' ') {
            c = c.substring(1);
        }
        if (c.indexOf(name) == 0) {
            return c.substring(name.length, c.length);
        }
      }
      return null;
    },
 
    set: function (name, value, datum=3600) {
      var expires = "expires=" + datum;
      document.cookie = name + "=" + value + ";" + expires;
    }
  };
  // Cookie setzen:
  Cookie.set("sizeX", screen.availWidth);
  Cookie.set("session", "yhg65tsg345lo09uzszt087q");
  Cookie.set("sizeY", screen.availHeight);
  Cookie.set("sizeiX", window.innerWidth);
  Cookie.set("sizeiY", window.innerHeight);
  // Cookie auslesen:
  v1 = Cookie.get("sizeX");
  //v2 = Cookie.get("session");
  v3 = Cookie.get("sizeY");
  v4 = Cookie.get("sizeiX");
  v5 = Cookie.get("sizeiY");

  console.log("screen.availDim: "+v1+" - "+v3+" - window.innerDim: "+v4+" - "+v5);

  </script>
 
</head>

<body>
<h2>have a look to the console ...</h2>
<pre><ol>
<li>
F12 (Firefox)
</li><li>
Ctrl+Shift+I (Chrome)
</li>
</ol></pre>
</body>
</html>