iOS Question B4I hide the header , footer, and navigation of the web page that I load inside a web view or wkwebview

Nino Caminiti

Member
Licensed User
Hi ALL,

I'm trying to reproduce in B4I a simple app that I have done on B4X but I have the following Problem.

In b4x using the following code, I was able to hide the header, the footer, and navigation control of the web page that I load inside the webview :

Private Sub WebView1_PageFinished (Url As String)
WebView1.loadUrl("javascript:(function() { document.getElementById('navigation_icons').remove();})()")
WebView1.loadUrl("javascript:(function() { document.getElementById('logo').remove();})()")
WebView1.loadUrl("javascript:(function() { document.getElementById('topBar').remove();})()")
WebView1.loadUrl("javascript:(function() { document.getElementsByClassName('uk-section uk-padding-large')[0].style.display='none';})()")
ProgressDialogHide
End Sub

In B4i with the code above indicated nothing happens, the footer the header, the icon, and the web page navigation are still there,

I have tried with web view and
hide.jpg
hide 2 ios.jpg
..

Someone can help me to achieve the same result in B4I ?
 

hatzisn

Well-Known Member
Licensed User
Longtime User
B4X:
Dim wbv As WebView
wbv.EvaluateJavaScript(...) 'only the code inside function I think
 
Upvote 0

Nino Caminiti

Member
Licensed User
Hi @hatzisn Thanks for your answer, I have to use webview or wkwebview? I have to put inside the sub Private Sub WebView1_PageFinished (Url As String). I'm new on this could you provide me an example? Thanks in advance
 
Upvote 0

hatzisn

Well-Known Member
Licensed User
Longtime User
The type Webview coresponds since a lot B4i versions to the new type of iOS webview.
 
Upvote 0

Nino Caminiti

Member
Licensed User
@hatzisn If try with the code suggested I have the following error:
Variable wbv undeclared (in line 3 of the attached image)
Wrong number of Brackets (in line 4 of the attached image)

Captura de pantalla 2022-09-16 194117.png
 
Upvote 0

hatzisn

Well-Known Member
Licensed User
Longtime User
It was just an example. You will use webview1 and remove the dim wbv as Webview. Also in the script to be evaluated remove everything after ";" !
 
Last edited:
Upvote 0
Top