Android Question webview and script?

FJS

Active Member
Licensed User
Longtime User
Hello everybody,

I am trying to use the following html code:

<script type="text/javascript" src="http://ad.leadboltads.net/show_app_ad.js?section_id=xxxxxxxxx"></script>

As you can see, the idea is showing ads, and in this case, the ads networking (leadbolt in fact), told me that is necessary to use a webview.

I tried it, with a webview like this:

WebView1.LoadHtml("<script type="text/javascript" src="http://ad.leadboltads.net/show_app_ad.js?section_id=xxxxxxxxx"></script>")

however it has a syntax error... and only the text apears in my screan

Please, any expert could you tell me how white right the information?

Thank you!
 

FJS

Active Member
Licensed User
Longtime User
you are a great, thank you

By the way, how is possible to change further characteristic of webview?, the image is not in the centre of the rectangule, and the background is white and I need to have it transparent..

Thank you again

Best regards
 
Upvote 0

FJS

Active Member
Licensed User
Longtime User
Thank you for recommendation

However there is another problem, now the ad image is showed perfectly with the Erel's recommendation, but if you press on the ad, a message appears: "webpage not available", so I suppose it is not right yet. Would you know the root case? and how to solve it?

Thanks again
 
Upvote 0

FJS

Active Member
Licensed User
Longtime User
I found the solution, and I would like to share it with all of you :

WebView1.LoadHtml($"<script type="text/javascript" src="http://ad.leadboltads.net/show_app_ad.js?section_id=xxxxxxxxx"></script>"$)

Sub WebView1_OverrideUrl (Url As String) As Boolean
If Url.EqualsIgnoreCase($"<script type="text/javascript" src="http://ad.leadboltads.net/show_app_ad.js?section_id=xxxxxxxxx"></script>"$) Then
Return False
Else
Dim i As Intent
i.Initialize(i.ACTION_VIEW, Url)
StartActivity(i)
Return True
End If
End Sub

With this the ad works perfectly.

However the ad shows not in the centre of the webview, and I dont know how to do transparent the background of the webview. Please.. anybody knows how to do it??

Thank you
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…