GERSON PINTO Member Licensed User Longtime User Jun 24, 2019 #1 Hello! Initially I used the code: Code: WebView1.GetSettings.SetLoadsImagesAutomatically(False) Images are not actually displayed but the image name appears in its place. Searching the internet I found the following code in javascript that seems to solve the problem but I do not know how to implement it: source:https://stackoverflow.com/questions/6856522/how-to-force-webview-to-skip-images Code: webView.loadUrl("javascript:(function(){ var imgs=document.getElementsByTagName('img');"+ "for(i=0;i<imgs.length;i++) { imgs[i].style.display='none'; } })()"); Could someone tell me how to implement this function in B4X or another way to do this? Thanks!
Hello! Initially I used the code: Code: WebView1.GetSettings.SetLoadsImagesAutomatically(False) Images are not actually displayed but the image name appears in its place. Searching the internet I found the following code in javascript that seems to solve the problem but I do not know how to implement it: source:https://stackoverflow.com/questions/6856522/how-to-force-webview-to-skip-images Code: webView.loadUrl("javascript:(function(){ var imgs=document.getElementsByTagName('img');"+ "for(i=0;i<imgs.length;i++) { imgs[i].style.display='none'; } })()"); Could someone tell me how to implement this function in B4X or another way to do this? Thanks!
Erel B4X founder Staff member Licensed User Longtime User Jun 24, 2019 #2 You are using WebViewExtra, right? You can execute JavaScript with ExecuteJavaScript (remove the javascript: scheme). Upvote 0
You are using WebViewExtra, right? You can execute JavaScript with ExecuteJavaScript (remove the javascript: scheme).
GERSON PINTO Member Licensed User Longtime User Jun 24, 2019 #3 Erel said: You are using WebViewExtra, right? You can execute JavaScript with ExecuteJavaScript (remove the javascript: scheme). Click to expand... Yes, webViewExtras.. Last edited: Jun 24, 2019 Upvote 0
Erel said: You are using WebViewExtra, right? You can execute JavaScript with ExecuteJavaScript (remove the javascript: scheme). Click to expand... Yes, webViewExtras..
GERSON PINTO Member Licensed User Longtime User Jun 24, 2019 #4 The JS code above not works and is equivalent to Code: WebView1.GetSettings.SetLoadsImagesAutomatically(False) or Code: WebView1.GetSettings.SetBlockNetworkImage(True) In fact the image is not shown but a broken image box appears! How do I remove broken image box? Can anyone help? Upvote 0
The JS code above not works and is equivalent to Code: WebView1.GetSettings.SetLoadsImagesAutomatically(False) or Code: WebView1.GetSettings.SetBlockNetworkImage(True) In fact the image is not shown but a broken image box appears! How do I remove broken image box? Can anyone help?
Brandsum Well-Known Member Licensed User Jun 24, 2019 #5 Try this Code: Sub WebView_PageFinished (Url As String) WebViewExtras.ExecuteJavascript("for(i=document.images.length-1;i>=0;i--) { document.images[i].remove() }") End Sub Last edited: Jun 24, 2019 Upvote 0
Try this Code: Sub WebView_PageFinished (Url As String) WebViewExtras.ExecuteJavascript("for(i=document.images.length-1;i>=0;i--) { document.images[i].remove() }") End Sub
GERSON PINTO Member Licensed User Longtime User Jun 24, 2019 #6 Brandsum said: Try this Code: Sub WebView_PageFinished (Url As String) WebViewExtras.ExecuteJavascript("for(i=document.images.length-1;i>=0;i--) { document.images[i].remove() }") End Sub Click to expand... Perfect! Works fine Thank you Brandsum! Upvote 0
Brandsum said: Try this Code: Sub WebView_PageFinished (Url As String) WebViewExtras.ExecuteJavascript("for(i=document.images.length-1;i>=0;i--) { document.images[i].remove() }") End Sub Click to expand... Perfect! Works fine Thank you Brandsum!