FrostCodes Active Member Licensed User Longtime User Jun 11, 2020 #1 Hi, how can I get something similar to WebView1_OverrideUrl like B4a in B4J. I want to intercept/stop certain URL requests in my webview. Last edited: Jun 11, 2020
Hi, how can I get something similar to WebView1_OverrideUrl like B4a in B4J. I want to intercept/stop certain URL requests in my webview.
Erel B4X founder Staff member Licensed User Longtime User Jun 12, 2020 #2 There is no similar feature in JavaFX WebView. Upvote 0
FrostCodes Active Member Licensed User Longtime User Jun 12, 2020 #3 Hi everyone and @Erel can you please check this link: https://www.codota.com/code/java/methods/javafx.scene.web.WebEngine/locationProperty I saw this code How to deny access to webpage from javafx web: WebEngine engine = webview.getEngine(); engine.locationProperty().addListener((observable, oldValue, newValue) -> { if (newValue.contains("badsite")) { // replace with your URL checking logic Platform.runLater(() -> { // Load your block page url engine.load("http://example.com")); } } }); but I don't know how to make it work for B4J Upvote 0
Hi everyone and @Erel can you please check this link: https://www.codota.com/code/java/methods/javafx.scene.web.WebEngine/locationProperty I saw this code How to deny access to webpage from javafx web: WebEngine engine = webview.getEngine(); engine.locationProperty().addListener((observable, oldValue, newValue) -> { if (newValue.contains("badsite")) { // replace with your URL checking logic Platform.runLater(() -> { // Load your block page url engine.load("http://example.com")); } } }); but I don't know how to make it work for B4J
Erel B4X founder Staff member Licensed User Longtime User Jun 12, 2020 #4 It is very simple: B4X: Sub WebView1_LocationChanged (Location As String) If Location.Contains("bad site") Then Sleep(0) WebView1.LoadUrl(...) End If End Sub Upvote 0
It is very simple: B4X: Sub WebView1_LocationChanged (Location As String) If Location.Contains("bad site") Then Sleep(0) WebView1.LoadUrl(...) End If End Sub