0

In webview, can you remove html elements from a live website before it loads to the user?

I've been looking at a bunch of stackoverflow questions regarding this, except I realized they were only locally hosted Web pages inside the app. None of their solutions worked for me.

Any help would be appreciated.

HaveNoDisplayName
  • 8,291
  • 106
  • 37
  • 47
m0nsta
  • 27
  • 3
  • 8
  • This is more about Javascript, not android question: i suggest you to add this tag. If, it is possible for js, so you could do it in webview for sure. – lewkka Nov 06 '15 at 15:34
  • In android studio, can I use just regular Javascript or do you need some special version for android? – m0nsta Nov 06 '15 at 15:44

2 Answers2

0

Read first about building apps in webview and how to use javascript in it. Then try to accomplish your goal using Javascript, because it cannot be done simply with webview on android. GL!

lewkka
  • 1,019
  • 15
  • 25
0

One easy way of doing that, will be to first make an http request to load the html data from the website. Then edit the data (remove whatever you don't like from it). Finally display it into the webview with loadData.

However this may not work as you expect, considering the css or javascript from the page you want to load may be in seperate files.

sonic
  • 1,894
  • 1
  • 18
  • 22
  • So I would do this? http://stackoverflow.com/questions/3505930/make-an-http-request-with-android#comment36345492_3509329 (3rd answer). This would get me the Html data? – m0nsta Nov 06 '15 at 16:35
  • Yes it would get you the html content of the page. – sonic Nov 07 '15 at 16:51