JAPS
JAPS

Reputation: 250

html string with image is not loading

Hey can any one suggest for web view. I have html string which has image URL.But image does not get loaded. Also I want back forward navigation.

What i am doing is

webView.loadDataWithBaseURL("data:", html, "text/html", "utf-8", html);

and

html="<html><script type=\"text/javascript\">
        function startTime(){var today=new Date();
        var h=today.getHours();
        var m=today.getMinutes();
        var s=today.getSeconds();
        m=checkTime(m);
        s=checkTime(s);
        document.getElementById('txt').innerHTML=h+\":\"+m+\":\"+s;
    }</script><body bgcolor=\"black\"><a href=\"image.png\" target=\"parent\" style=\"color:pink\">TESTING NOTES</a>
<p style=\"color:white\" >Finding faults early</p><p style=\"color:white\">To Test Reload Check Current Time:<div id=\"txt\" style=\"color:white\"></div></p></body></html>";

image.png is in asset folder.Also javascript is not executing!

Upvotes: 0

Views: 255

Answers (2)

benni_mac_b
benni_mac_b

Reputation: 8877

If the image is in the assets folder would it need to be something like the below to load when clicked

<a href="assets\image.png">TESTING NOTES</a>

Upvotes: 0

Shadow Wizard
Shadow Wizard

Reputation: 66388

The image.png is inside HTML anchor there's no reason for it to be loaded.

To show image, use tag named <img> like this:

<img src="image.png" />

You better learn some basic HTML, there are great many tutorials online and books.

As for JavaScript, you got it inside a function called startTime but nothing is calling it - not sure how you expect it to execute.

Upvotes: 3

Related Questions