2

I want to use jscript to set cookie inside my JavaFX application in browser .

I tried to use JsObject for this purpose but it did not work properly and is throwing an exception:

SECURITY_ERR: DOM Exception 18

This is the code I used:

public static void writeCookies(String data) {
    WebEngine engine = new WebEngine();
    JSObject doc = (JSObject) engine.getDocument();
    data = cookieName + "=" + data + "; expires=" + Helpers.getGMTexpireDate(120);
    doc.setMember("cookie", data);
}

I was using JSObject.getWindow(this) and executing jscript code in Applet, but in JavaFX, getting JSObject in such a way does not work. I can force it to work only by removing jfxrt.jar. (solving a conflict between jxfrt.jar and plugin.jar).

Unfortunately, this option does not suit us because the project highly depends on JavaFX fxml.
How can i properly call jscript functions from JavaFX?

user123
  • 8,970
  • 2
  • 31
  • 52
Fariz Aghayev
  • 649
  • 5
  • 17
  • 1
    here u can get your answer http://stackoverflow.com/questions/14385233/setting-a-cookie-using-javafxs-webengine-webview – qwr May 13 '13 at 06:14

0 Answers0