Android Cordova App with IFrames Chrome 63 No Request Headers Cookies Android Cordova App with IFrames Chrome 63 No Request Headers Cookies google-chrome google-chrome

Android Cordova App with IFrames Chrome 63 No Request Headers Cookies


This bug was filed and addressed in the Chromium Bug tracker. According to the Chromium devs, there's nothing we can do from the App side of things.


Here is a way to reproduce the issue without Cordova. It uses http://httpbin.org/cookies/set?k2=v2&k1=v1 to test cookies. With Android System WebView v. 63 the cookies are not sent. With previous versions they are sent. I hope it can help to find the answer to the question. Here is a link to the full Android project: https://www.dropbox.com/s/s53wfy71uou11rh/test-webview.zip?dl=0

MainActivity.java

package com.example.mihai.twv;import android.os.Build;import android.support.v7.app.AppCompatActivity;import android.os.Bundle;import android.webkit.CookieManager;import android.webkit.WebView;import java.io.InputStream;public class MainActivity extends AppCompatActivity {    WebView mWebView;    @Override    protected void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        setContentView(R.layout.activity_main);        initWebView();        loadWebView();    }    private void initWebView() {        mWebView = (WebView) findViewById(R.id.webView);        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {            WebView.setWebContentsDebuggingEnabled(true);        }        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {            CookieManager.getInstance().setAcceptThirdPartyCookies(mWebView, true);        }    }    private void loadWebView() {        String url = "http://httpbin.org";        String html = getLocalFileContents("html/main.html");        mWebView.loadDataWithBaseURL(url, html, "text/html", "UTF-8", null);    }    private String getLocalFileContents(String filepath) {        String response = "";        try {            InputStream is = getAssets().open(filepath);            int size = is.available();            StringBuilder builder = new StringBuilder();            byte[] buffer = new byte[size];            while (is.read(buffer) != -1) {                builder.append(new String(buffer, "UTF-8"));            }            is.close();            response = builder.toString();        } catch (Exception e) {        }        return response;    }}

html/main.html (in assets folder)

<html><head>    <base href="file:///android_asset/html/">    <link type="text/css" rel="stylesheet" href="../css/main.css" /></head><body>    <iframe src="http://httpbin.org/cookies/set?k1=v1&k2=v2" frameborder="0"></iframe></body>

css/main.css (in assets folder)

html,body,iframe {  width: 100%;  height: 100%;}


This was a bug in Chrome, it has been fixed. I updated Chrome again and it works fine now on my device.

What we can learn from this is that Cordova depends on other apps...