I am currently developing a mobile / tablet application and i've run into a stump.
I have a webview that loads a form from a website that i have no control over, this website utilises the django platform.

So the situation is this:

The form on the foreign website uses ajax to send through a JSON encode string and returns a JSON object. - simple

My issue is this, From a desktop browser or a mobile browser, this process works perfectly fine.
Enter credentials->returns json->redirects to logged in backend.

From a Android WebView i keep getting this in the information log:
4376-4376/<package name> I/chromium´╣Ľ [INFO:CONSOLE(72)] "[object Object]", source: <foreign site url> (72)
It doesn't redirect me either, It just sits at the login form.

My Code is below for the WebView:

protected void onCreate(Bundle savedInstanceState) {

        gWebView = (WebView) findViewById(R.id.statisticsmap);

        // Enable Javascript
        WebSettings webSettings = gWebView.getSettings();

        gWebView.setWebViewClient(new MyAppWebViewClient());
        gWebView.loadUrl(<clients url>);

Is there some sort of websetting or permission that i am missing?
It just seems like the weview isn't processing the json.

I did notice that the foreign website does use a csrf token...

//set our CSRF Token for our ajax requests
    beforeSend: function(xhr, settings) {
        xhr.setRequestHeader("X-CSRFToken", $('[name="csrfmiddlewaretoken"]').val());
    document.getElementById('greenbtn').onclick = function(e) {
        json_object = {"Username" : $("#inputEmail").val(), "Password" : $("#inputPassword").val()};
            url: '/login',
            type: 'POST',
            contentType: 'application/json; charset=utf-8',
            data: JSON.stringify(json_object),
            dataType: 'json',
            success: function(result) {
                if (result["status"]=="Success"){
                else {
            fail: function(result){
                alert("somethings has gone wrong, Please try again later");

I have read that the Android system doesnt respond well to : window.location.replace - but i think that might have been a very old article,

Any help would be greatly appreciated!

Thank you in advance.

Edited by Macko888

2 Years
Discussion Span
Last Post by Macko888

My Apologies,
I have sorted it out....

I had the endsWith section in the MyAppWebViewClient returning true instead of false.... Simple error.

public class MyAppWebViewClient extends WebViewClient {

    public boolean shouldOverrideUrlLoading(WebView view, String url) {

        if(Uri.parse(url).getHost().endsWith("<client url>")) {
            return false;

        Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
        return true;
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.