0

I'm loading a website in Android WebView in which each page is loaded dynamically by changing content of div,I have to check for cookies frequently whenever next page is loaded(i.e,whenever the content of div is changed) and then redirect to Activity accordingly.

I'm able to detect cookies the very first time the page is loaded,but since only the div is changing and not the url,I'm not able to detect or not able to check cookies second time.

Any idea of how to deal with this?

Any help on this is highly appreciated!!

Andres Cárdenas
  • 720
  • 1
  • 5
  • 26
Vijay
  • 11
  • 3

1 Answers1

0

The specific design you're describing is pretty hard to deal with.

If you are able to control the content of the page I would suggest having the JavaScript that changes the div contents also communicate back the new state to the app (see this SO question on how to do this).

If you are unable to control the content you could use WebViewClient.shouldInterceptRequest to "monitor" the requests made by the page but this includes all the requests made by the WebView so it might be hard to filter out just the ones made by the changing div.

Community
  • 1
  • 1
marcin.kosiba
  • 3,221
  • 14
  • 19
  • Thanks for suggestion,I'll try with that and is it possible to do with Threads to check with Cookies frequently? – Vijay Nov 27 '14 at 04:36
  • @Vijay - "it possible to do with Threads to check with Cookies" - sorry, I don't understand that bit. If you're trying to check if there is an auth cookie (using CookieManager APIs) using a separate thread then that should be fine. – marcin.kosiba Dec 02 '14 at 10:30