{"action":"created","issue":{"url":"https://api.github.com/repos/ui4j/ui4j/issues/55","labels_url":"https://api.github.com/repos/ui4j/ui4j/issues/55/labels{/name}","comments_url":"https://api.github.com/repos/ui4j/ui4j/issues/55/comments","events_url":"https://api.github.com/repos/ui4j/ui4j/issues/55/events","html_url":"https://github.com/ui4j/ui4j/issues/55","id":88205120,"number":55,"title":"Can't access client side cookies ","user":{"login":"hstaudacher","id":289648,"avatar_url":"https://avatars.githubusercontent.com/u/289648?v=3","gravatar_id":"","url":"https://api.github.com/users/hstaudacher","html_url":"https://github.com/hstaudacher","followers_url":"https://api.github.com/users/hstaudacher/followers","following_url":"https://api.github.com/users/hstaudacher/following{/other_user}","gists_url":"https://api.github.com/users/hstaudacher/gists{/gist_id}","starred_url":"https://api.github.com/users/hstaudacher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hstaudacher/subscriptions","organizations_url":"https://api.github.com/users/hstaudacher/orgs","repos_url":"https://api.github.com/users/hstaudacher/repos","events_url":"https://api.github.com/users/hstaudacher/events{/privacy}","received_events_url":"https://api.github.com/users/hstaudacher/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-06-14T15:53:11Z","updated_at":"2015-06-17T11:39:29Z","closed_at":null,"body":"The `Interceptor` mechanism works create to access cookies that were set by the server. But you have no chance to access cookies that are set by the client e.g. via JavaScript.\r\n\r\nExample html:\r\n\r\n```html\r\n<!DOCTYPE html>\r\n<html>\r\n  <head>\r\n  <title>Session Test</title>\r\n  </head>\r\n  <body>\r\n    \r\n    <ul id=\"cookies\"></ul>\r\n    \r\n    <script src=\"js/jquery-2.1.4.min.js\" type=\"text/javascript\"></script>\r\n    <script type=\"text/javascript\">\r\n      \r\n      var pairs = document.cookie.split( \";\" );\r\n      for( var i = 0; i < pairs.length; i++ ) {\r\n        if( pairs[ i ] !== \"\" ) {\r\n          var pair = pairs[ i ].split( \"=\" );\r\n          $( \"#cookies\" ).append( \"<li>\" + pair[ 0 ] + \"=\" + unescape( pair[1] ) );\r\n        }\r\n      }\r\n      \r\n      function createCookie(name, value, days) {\r\n          var expires;\r\n\r\n          if (days) {\r\n              var date = new Date();\r\n              date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));\r\n              expires = \"; expires=\" + date.toGMTString();\r\n          } else {\r\n              expires = \"\";\r\n          }\r\n          document.cookie = encodeURIComponent(name) + \"=\" + encodeURIComponent(value) + expires + \"; path=/\";\r\n      }\r\n      \r\n      function guid() {\r\n        function s4() {\r\n          return Math.floor((1 + Math.random()) * 0x10000)\r\n            .toString(16)\r\n            .substring(1);\r\n        }\r\n        return s4() + s4() + '-' + s4() + '-' + s4() + '-' +\r\n          s4() + '-' + s4() + s4() + s4();\r\n      }\r\n\r\n      function readCookie(name) {\r\n          var nameEQ = encodeURIComponent(name) + \"=\";\r\n          var ca = document.cookie.split(';');\r\n          for (var i = 0; i < ca.length; i++) {\r\n              var c = ca[i];\r\n              while (c.charAt(0) === ' ') c = c.substring(1, c.length);\r\n              if (c.indexOf(nameEQ) === 0) return decodeURIComponent(c.substring(nameEQ.length, c.length));\r\n          }\r\n          return null;\r\n      }\r\n      \r\n      if( readCookie( \"foobar\" ) == null ) {\r\n        createCookie( \"foobar\", guid(), 1 );\r\n      }\r\n      \r\n    </script>\r\n    \r\n  </body>\r\n</html>\r\n```\r\nThe is no way to access the cookie \"foobar\" via UI4J API."},"comment":{"url":"https://api.github.com/repos/ui4j/ui4j/issues/comments/112762409","html_url":"https://github.com/ui4j/ui4j/issues/55#issuecomment-112762409","issue_url":"https://api.github.com/repos/ui4j/ui4j/issues/55","id":112762409,"user":{"login":"hstaudacher","id":289648,"avatar_url":"https://avatars.githubusercontent.com/u/289648?v=3","gravatar_id":"","url":"https://api.github.com/users/hstaudacher","html_url":"https://github.com/hstaudacher","followers_url":"https://api.github.com/users/hstaudacher/followers","following_url":"https://api.github.com/users/hstaudacher/following{/other_user}","gists_url":"https://api.github.com/users/hstaudacher/gists{/gist_id}","starred_url":"https://api.github.com/users/hstaudacher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hstaudacher/subscriptions","organizations_url":"https://api.github.com/users/hstaudacher/orgs","repos_url":"https://api.github.com/users/hstaudacher/repos","events_url":"https://api.github.com/users/hstaudacher/events{/privacy}","received_events_url":"https://api.github.com/users/hstaudacher/received_events","type":"User","site_admin":false},"created_at":"2015-06-17T11:39:29Z","updated_at":"2015-06-17T11:39:29Z","body":"With the latest version I'm getting this exception\r\n\r\n```java\r\nException in thread \"JavaFX Application Thread\" com.ui4j.api.util.Ui4jException: netscape.javascript.JSException: Error: SecurityError: DOM Exception 18\r\n\tat com.ui4j.webkit.proxy.WebKitProxy$CallableExecutor.run(WebKitProxy.java:48)\r\n\tat com.sun.javafx.application.PlatformImpl$6$1.run(PlatformImpl.java:301)\r\n\tat com.sun.javafx.application.PlatformImpl$6$1.run(PlatformImpl.java:298)\r\n\tat java.security.AccessController.doPrivileged(Native Method)\r\n\tat com.sun.javafx.application.PlatformImpl$6.run(PlatformImpl.java:298)\r\n\tat com.sun.glass.ui.monocle.RunnableProcessor.runLoop(RunnableProcessor.java:77)\r\n\tat com.sun.glass.ui.monocle.RunnableProcessor.run(RunnableProcessor.java:47)\r\n\tat java.lang.Thread.run(Thread.java:745)\r\nCaused by: netscape.javascript.JSException: Error: SecurityError: DOM Exception 18\r\n\tat com.sun.webkit.dom.JSObject.fwkMakeException(JSObject.java:128)\r\n\tat com.sun.webkit.WebPage.twkExecuteScript(Native Method)\r\n\tat com.sun.webkit.WebPage.executeScript(WebPage.java:1410)\r\n\tat javafx.scene.web.WebEngine.executeScript(WebEngine.java:934)\r\n\tat com.ui4j.webkit.spi.WebKitJavaScriptEngine.executeScript(WebKitJavaScriptEngine.java:26)\r\n\tat com.ui4j.webkit.browser.WebKitPage.executeScript(WebKitPage.java:231)\r\n\tat com.ui4j.webkit.browser.WebKitPage$ByteBuddy$Mw20d5vN.executeScript$accessor$TXJsuC0z(Unknown Source)\r\n\tat com.ui4j.webkit.browser.WebKitPage$ByteBuddy$Mw20d5vN$auxiliary$RsUWhf6Q.call(Unknown Source)\r\n\tat com.ui4j.webkit.proxy.WebKitProxy$CallableExecutor.run(WebKitProxy.java:46)\r\n```"}}