tags:

views:

20

answers:

1

There's a webpage I pull up with webview, however i'd like to hide the 1 text link at the top. Is there a way to do this? The link is in the body, so I can't hide the body element in whole. The webpage is all text, and one tiny image at the bottom, but the text is generated each time you load it, so I can't just copy/paste the body.

Thanks

A: 

I got it! By injecting javascript I had to use

webview.loadUrl("javascript:(function() { " + "document.getElementsByTagName('a')[0].style.display = 'none'; " + "})()");

That removes the link ( code). Replacing ('a') with ('img') would remove the images.

(thanks [url=http://lexandera.com/2009/01/injecting-javascript-into-a-webview/]lexanderA Injecting JavaScript into a WebView[/url] )

ajent