{"id":14483,"date":"2017-10-24T07:00:05","date_gmt":"2017-10-23T22:00:05","guid":{"rendered":"http:\/\/www.techscore.com\/blog\/?p=14483"},"modified":"2018-11-14T16:33:43","modified_gmt":"2018-11-14T07:33:43","slug":"meta-set-cookie","status":"publish","type":"post","link":"https:\/\/www.techscore.com\/blog\/2017\/10\/24\/meta-set-cookie\/","title":{"rendered":"META \u8981\u7d20 + Set-Cookie \u306b\u3064\u3044\u3066"},"content":{"rendered":"<p><img loading=\"lazy\" src=\"https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2017\/10\/shutterstock_484412023.jpg\" alt=\"\" width=\"300\" height=\"182\" class=\"alignnone size-medium wp-image-14485\" srcset=\"https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2017\/10\/shutterstock_484412023.jpg 1000w, https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2017\/10\/shutterstock_484412023-300x182.jpg 300w, https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2017\/10\/shutterstock_484412023-768x465.jpg 768w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>\u3053\u3093\u306b\u3061\u306f\u3001\u4e2d\u5c71\u3067\u3059\uff08\u5199\u771f\u306f\u79c1\u3067\u306f\u3042\u308a\u307e\u305b\u3093\uff09\u3002<br \/>\n\u5199\u771f\u3068\u540c\u69d8\u3001\u65e2\u306b\u7d76\u6ec5\u3057\u3066\u3057\u307e\u3063\u305f\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304c\u3001\u4ee5\u524d\u306f META \u8981\u7d20\u3092\u7528\u3044\u3066 Set-Cookie \u3092\u5b9f\u884c\u3059\u308b Web \u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304c\u5b58\u5728\u3057\u307e\u3057\u305f\u3002<br \/>\n\u305d\u3053\u3067\u3001\u4eca\u66f4\u3067\u3059\u304c META \u8981\u7d20 + Set-Cookie \u306b\u3064\u3044\u3066\u8003\u5bdf\u3057\u3066\u307f\u307e\u3059\u3002<br \/>\n\u306a\u304a\u8abf\u67fb\u306b\u5229\u7528\u3057\u305f\u30d6\u30e9\u30a6\u30b6\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002<br \/>\n\uff08iOS \u3068 Android \u306e\u6a19\u6e96\u30d6\u30e9\u30a6\u30b6\u306b\u3064\u3044\u3066\u306f\u307e\u305f\u306e\u6a5f\u4f1a\u306b\uff09<\/p>\n<ul>\n<li>IE 11.0.46<\/li>\n<li>Firefox 55.0.3<\/li>\n<li>Chrome 61.0.3163.91<\/li>\n<\/ul>\n<h2>HTML5 \u4ed5\u69d8\u306e\u78ba\u8a8d<\/h2>\n<p><a href=\"https:\/\/www.w3.org\/TR\/html5\/document-metadata.html#pragma-directives\" target=\"_blank\">HTML5 \u4ed5\u69d8<\/a> \u306b\u3088\u308c\u3070 META \u8981\u7d20\u3067\u306e Set-Cookie \u306f non-conforming \u3068\u306a\u3063\u3066\u3044\u307e\u3059\u3002<br \/>\n\uff08\u306a\u306e\u3067\u3001\u3053\u308c\u304b\u3089\u958b\u767a\u3059\u308b Web \u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3067\u306e\u5229\u7528\u306f\u3084\u3081\u3066\u304a\u304d\u307e\u3057\u3087\u3046\uff09<\/p>\n<blockquote><p>\nCookie setter (http-equiv=\"set-cookie\")<br \/>\nThis pragma sets an HTTP cookie.<br \/>\nIt is non-conforming.<br \/>\nReal HTTP headers should be used instead.\n<\/p><\/blockquote>\n<p>\u52d5\u4f5c\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n<blockquote><p>\n1. If the meta element has no content attribute, or if that attribute's value is the empty string, then abort these steps.<br \/>\n2. Obtain the storage mutex.<br \/>\n3. Act as if receiving a set-cookie-string for the document's address via a \"non-HTTP\" API, consisting of the value of the element's content attribute encoded as UTF-8.\n<\/p><\/blockquote>\n<p>HTTP\uff08Set-Cookie Header\uff09\u7d4c\u7531\u3067\u306f\u306a\u304f\u3001\u5b9f\u8cea\u7684\u306b\u306f document.cookie \u3078\u306e\u66f8\u304d\u8fbc\u307f\u3068\u540c\u69d8\u306b\u632f\u821e\u3046\u3079\u3057\u3001\u3068\u898f\u5b9a\u3055\u308c\u3066\u3044\u307e\u3059\u306d\u3002<\/p>\n<h2>\u5404\u30d6\u30e9\u30a6\u30b6\u306e\u52d5\u4f5c<\/h2>\n<p>\u4e09\u901a\u308a\u306e\u52d5\u4f5c\u3092\u78ba\u8a8d\u3057\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<br \/>\n\u307e\u305a\u306f\u9759\u7684\u306a META \u8981\u7d20\u3067\u306e Set-Cookie \u304c\u52d5\u4f5c\u3059\u308b\u304b\u5426\u304b\uff08#1\uff09\u3002<\/p>\n<pre class=\"lang:javascript\">\r\n<head>\r\n    <meta http-equiv='Set-Cookie' content='KEY=INIT'>\r\n<\/head>\r\n<script>\r\n(function() {\r\n    \/* \u78ba\u8a8d *\/\r\n    window.setTimeout(function() {\r\n        alert(document.cookie);\r\n    }, 1000);\r\n})();\r\n<\/script>\r\n<\/pre>\n<p>\u6b21\u306b content \u5c5e\u6027\u3092 JavaScript \u3067\u5909\u66f4\u3057\u305f\u5834\u5408\u3001\u5909\u66f4\u304c\u53cd\u6620\u3055\u308c\u308b\u304b\u5426\u304b\uff08#2\uff09\u3002<\/p>\n<pre class=\"lang:javascript\">\r\n<head>\r\n    <meta http-equiv='Set-Cookie' content='KEY=INIT'>\r\n<\/head>\r\n<script>\r\n(function(in_key, in_value) {\r\n    \/* content \u5c5e\u6027\u306e\u5909\u66f4 *\/\r\n    var meta = document.getElementsByTagName('META').item(0);\r\n    meta.setAttribute('content', in_key + '=' + in_value);\r\n    \/* \u78ba\u8a8d *\/\r\n    window.setTimeout(function() {\r\n        alert(document.cookie);\r\n    }, 1000);\r\n})('KEY', 'UPDATE');\r\n<\/script>\r\n<\/pre>\n<p>\u6700\u5f8c\u306b META \u8981\u7d20\uff08Set-Cookie \u3092\u5b9f\u884c\u3059\u308b\uff09\u3092\u52d5\u7684\u306b DOM \u306b\u8ffd\u52a0\u3057\u305f\u5834\u5408\u3001cookie \u304c\u66f8\u304d\u8fbc\u307e\u308c\u308b\u304b\u5426\u304b\uff08#3\uff09\u3002<\/p>\n<pre class=\"lang:javascript\">\r\n<script>\r\n(function(in_key, in_value) {\r\n    \/* HEAD + META \u8981\u7d20\u306e\u8ffd\u52a0 *\/\r\n    var meta = document.createElement('META');\r\n    meta.setAttribute('http-equiv', 'Set-Cookie');\r\n    meta.setAttribute('content', in_key + '=' + in_value);\r\n    var head = document.createElement('HEAD');\r\n    head.appendChild(meta);\r\n    var target = document.getElementsByTagName('SCRIPT').item(0);\r\n    target.parentNode.insertBefore(head, target);\r\n    \/* \u78ba\u8a8d *\/\r\n    window.setTimeout(function() {\r\n        alert(document.cookie);\r\n    }, 1000);\r\n})('KEY', 'UPDATE');\r\n<\/script>\r\n<\/pre>\n<p>\u52d5\u4f5c\u7d50\u679c\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002<br \/>\nHTML5 \u4ed5\u69d8\u3067\u306f non-conforming \u306b\u3082\u95a2\u308f\u3089\u305a Chrome \u306e\u5b9f\u88c5\u306f\u7d30\u3084\u304b\u3067\u3059\u306d\u3002<\/p>\n<p><img loading=\"lazy\" width=\"552\" height=\"81\" src=\"https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2017\/10\/meta.png\" alt=\"\" xwidth=\"300\" xheight=\"44\" class=\"alignnone size-medium wp-image-14494\" srcset=\"https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2017\/10\/meta.png 552w, https:\/\/www.techscore.com\/blog\/wp\/wp-content\/uploads\/2017\/10\/meta-300x44.png 300w\" sizes=\"(max-width: 552px) 100vw, 552px\" \/><\/p>\n<h2>\u86c7\u8db3<\/h2>\n<p>\u9759\u7684\u306a META \u8981\u7d20\u3067\u306e Set-Cookie \u306f\u4e3b\u8981\u30d6\u30e9\u30a6\u30b6\u3067\u52d5\u4f5c\u3059\u308b\u3053\u3068\u304c\u78ba\u8a8d\u3067\u304d\u307e\u3057\u305f\u304c\u3001\u5c06\u6765\u306b\u308f\u305f\u308a\u52d5\u4f5c\u4fdd\u8a3c\u3055\u308c\u308b\u308f\u3051\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002<br \/>\n\u306a\u306e\u3067\u3001\u4eca\u5f8c\u5229\u7528\u3055\u308c\u308b\u3053\u3068\u3082\u306a\u3055\u305d\u3046\u3067\u3059\u304c\u3001\u3075\u3068 JavaScript \u304c\u4f7f\u3048\u306a\u3044 AMP \u3067 <a href=\"http:\/\/www.techscore.com\/blog\/2017\/10\/06\/about-cookie\/\" target=\"_blank\">Parasite Cookie<\/a> \u306e\u4ed5\u8fbc\u307f\u306b\u4f7f\u3048\u306a\u3044\u3060\u308d\u3046\u304b !? \u3068\u601d\u3044\u307e\u3057\u305f\u304c\uff08\u672a\u8abf\u67fb\u3067\u3059\uff09\u3001JavaScript \u304c\u4f7f\u3048\u306a\u3044\u306a\u3089\u4ed5\u8fbc\u3093\u3067\u3082\u8aad\u3081\u306a\u3044\u306e\u3067\u7121\u610f\u5473\u3067\u3059\u306d\u3002<\/p>\n<p>\u3061\u306a\u307f\u306b <a href=\"https:\/\/www.ampproject.org\/ja\/docs\/reference\/spec\" target=\"_blank\">AMP HTML<\/a> \u3067\u306f http-equiv \u306f\u5229\u7528\u3067\u304d\u308b\u3088\u3046\u3067\u3059\u3002<\/p>\n<blockquote><p>\nmeta<br \/>\nThe http-equiv attribute may be used for specific allowable values; see the AMP validator specification for details.\n<\/p><\/blockquote>\n<p>\u73fe\u5834\u304b\u3089\u306e\u30ec\u30dd\u30fc\u30c8\u306f\u4ee5\u4e0a\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306f\u3001\u4e2d\u5c71\u3067\u3059\uff08\u5199\u771f\u306f\u79c1\u3067\u306f\u3042\u308a\u307e\u305b\u3093\uff09\u3002<br \/>\n\u5199\u771f\u3068\u540c\u69d8\u3001\u65e2\u306b\u7d76\u6ec5\u3057\u3066\u3057\u307e\u3063\u305f\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304c\u3001\u4ee5\u524d\u306f META \u8981\u7d20\u3092\u7528\u3044\u3066 Set-Cookie \u3092\u5b9f\u884c\u3059\u308b Web \u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304c\u5b58\u5728\u3057\u307e\u3057\u305f\u3002<br \/><a href=\"https:\/\/www.techscore.com\/blog\/2017\/10\/24\/meta-set-cookie\/\">\u7d9a\u304d\u3092\u8aad\u3080...<\/a><\/p>\n","protected":false},"author":19,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[18],"tags":[274,273,20,53,184],"_links":{"self":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts\/14483"}],"collection":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/users\/19"}],"replies":[{"embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/comments?post=14483"}],"version-history":[{"count":21,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts\/14483\/revisions"}],"predecessor-version":[{"id":14532,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts\/14483\/revisions\/14532"}],"wp:attachment":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/media?parent=14483"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/categories?post=14483"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/tags?post=14483"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}