I have a problem in getting the size of the content of a web view..here is my code
String heightText = (String) engine.executeScript("window.getComputedStyle(document.body,null).getPropertyValue('height')");
double height = Double.valueOf(heightText.replace("px", ""));
String widthText = web1.getEngine().executeScript(
"window.getComputedStyle(document.body,null).getPropertyValue('width')"
).toString();
double width = Double.valueOf(widthText.replace("px", ""));
web1.setPrefHeight(height);
web1.setPrefWidth(width);
System.out.println(height + " " + width);
}
but it refers 0 at first time and in the other times it has wrong result.
actually I had to edit my question. the above code shows the size of the previous content.. why is it like this? please help. thank you