shayan
shayan

Reputation: 79

How to set webview editable false in JavaFX

I have a webview that loads HTMLEditor's text. I don't want it to be editable. can anyone help?

thanks.

Upvotes: 2

Views: 2107

Answers (1)

shayan
shayan

Reputation: 79

HTMLEditor htmlEd=new HTMLEditor();
String st=htmlEd.getHtmlText();
WebView browser=new WebView();                     
WebEngine webEngine=browser.getEngine();

if(st.contains("contenteditable=\"true\"")){
    st=st.replace("contenteditable=\"true\"", "contenteditable=\"false\"");
}
webEngine.loadContent(st);

I solved my problem in this way.

Upvotes: 4

Related Questions