Karan Jit Singh
Karan Jit Singh

Reputation: 605

check when WebView has completely loaded including url redirection

Suppose there is a website which on loading automatically redirects to another url somewhat like this http://mydomain.com/ -> http://mydomain.com/index.html.

Now whenever WebView.loadURL("http://mydomain.com/") is called onPageFinished() obviously is loaded twice. I want to be able to run my code after all of the loading is done including the automatic redirection.

Upvotes: 1

Views: 121

Answers (1)

Quin
Quin

Reputation: 386

When the page has finished loading, check if the HTTP Response code was 200 OK. If it is a redirect, it will be a 301 or 303. Depending upon that you can ignore the onPageFinished() listener.

Upvotes: 1

Related Questions