Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable javascript from running in javafx webview

I would like to know if javascript can be disabled in WebView of Javafx. I have searched the web but cant get any information about this.

The link in Oracle website says that javascript can be enabled and disabled but cant find any documentation.

Thanks..

like image 587
Dinesh Ravichandran Avatar asked Dec 03 '13 04:12

Dinesh Ravichandran


1 Answers

You have to set Javascript disabled on the WebEngine itself that the WebView controls.

WebView browser = new WebView();
WebEngine webEngine = browser.getEngine();
webEngine.setJavaScriptEnabled(false);
like image 181
Josiah Hester Avatar answered Sep 24 '22 10:09

Josiah Hester