Android Question webview and script?

Discussion in 'Android Questions' started by FJS, Jun 20, 2015.

  1. FJS

    FJS Active Member Licensed User

    Hello everybody,

    I am trying to use the following html code:

    <script type="text/javascript" src=""></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=""></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!
    Devan likes this.
  2. Erel

    Erel Administrator Staff Member Licensed User

    Change your code to:
    WebView1.LoadHtml($"<script type="text/javascript" src=""></script>"$)
    Devan likes this.
  3. FJS

    FJS Active Member Licensed 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
  4. warwound

    warwound Expert Licensed User

    Devan and DonManfred like this.
  5. FJS

    FJS Active Member Licensed 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
  6. FJS

    FJS Active Member Licensed User

    I found the solution, and I would like to share it with all of you :):):):):

    WebView1.LoadHtml($"<script type="text/javascript" src=""></script>"$)

    Sub WebView1_OverrideUrl (Url As String) As Boolean
    If Url.EqualsIgnoreCase($"<script type="text/javascript" src=""></script>"$) Then
    Return False
    Dim i As Intent
    i.Initialize(i.ACTION_VIEW, Url)
    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
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice