iOS Question [RESOLVED] Click webview to B4I

Duque

Active Member
Licensed User
Longtime User
After 3 days of searching for solutions and trying almost everything, I don't want to give up on b4i.
Context:
I have a table in a Webview, the user can click on a cell and see information (this is already done for b4a and b4j).

For b4a I use this in webview, WebViewExtras:
<script>
function pulsa_cell(myDato){
B4A.CallSub('pulsa_cell',true,myDato);
}
</script>

For b4j I use this in webview, setBridge:
<script>
function pulsa_cell(myDato){
b4j.link2(myDato);
}
</script>

After 3 days of searching the forum, I found some links, where they say they solve it for b4i but they don't leave any example

I understood that iOS does things differently and I must activate the OverrideUrl event.
For B4i I use this in webview, IT DOES NOT WORK:
<script>
function pulsa_cell(myDato){
window.location.href;
}
</script>
When I click on the web view cell it does nothing
HTML button:
<td>
<button onclick="pulsa_cell('string_json_b64')">Web to B4i</button>
</td>

Please help me !
 

arifkibrit

Member
Licensed User
After 3 days of searching for solutions and trying almost everything, I don't want to give up on b4i.
Context:
I have a table in a Webview, the user can click on a cell and see information (this is already done for b4a and b4j).

For b4a I use this in webview, WebViewExtras:
<script>
function pulsa_cell(myDato){
B4A.CallSub('pulsa_cell',true,myDato);
}
</script>

For b4j I use this in webview, setBridge:
<script>
function pulsa_cell(myDato){
b4j.link2(myDato);
}
</script>

After 3 days of searching the forum, I found some links, where they say they solve it for b4i but they don't leave any example

I understood that iOS does things differently and I must activate the OverrideUrl event.
For B4i I use this in webview, IT DOES NOT WORK:
<script>
function pulsa_cell(myDato){
window.location.href;
}
</script>
When I click on the web view cell it does nothing
HTML button:
<td>
<button onclick="pulsa_cell('string_json_b64')">Web to B4i</button>
</td>

Please help me !
window.location.href = window.location + "&string_json_b64";


you can use something like that in your webpage and handle in B4I something like
Private Sub WebView1_OverrideUrl (Url As String)
 
Upvote 0

Duque

Active Member
Licensed User
Longtime User
If you have this same problem, check out my solution.
In JavaScript:
<script>
function pulsa_cell(myDato){
window.location.href = window.location + "INI_B64" + myDato;
}
</script>

This could be more elegant, but I was 3 days late so I did it quickly...
In B4i:
Private Sub tabla_OverrideUrl (Url As String) As Boolean
Dim const IDentificador As String = "INI_B64"  
If (Url.Contains(IDentificador)) Then
Dim const recortar As Int = Url.IndexOf(IDentificador)  + IDentificador.Length
dim const myDato as string = Url.SubString2(recortar, Url.Length)
log(myDato) '<---Capture the parameter I want from the web view
End If
Return True
End Sub
 
Last edited:
Upvote 0
Top