創(chuàng)建WebView之前,設(shè)置代理,代碼如下所示:
System.setProperty("http.proxyHost", "127.0.0.1");
System.setProperty("http.proxyPort", "10809");
System.setProperty("https.proxyHost", "127.0.0.1");
System.setProperty("https.proxyPort", "10809");
webView = new WebView();
webEngine = webView.getEngine();
webEngine.setJavaScriptEnabled(true);
webEngine.load("https://gmail.com/");
效果如下圖:

image
DONE!
歡迎點(diǎn)贊!