Android- EXTRA_HEADERS is not reflecting in updated Chrome version greater than 83

China☆狼群 提交于 2020-08-20 06:29:07

问题


Earlier the EXTRA_HEADERS passed to the customTabsIntent.intent.putExtra(Browser.EXTRA_HEADERS, headers), was working fine. After Chrome updated to 83, it stopped passing the header data.

   public static void startCustomTab(String url, Context context) {
    CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
    CustomTabsIntent customTabsIntent = builder.build();
    builder.setShowTitle(true);
    Bundle headers = new Bundle();
    headers.putString(context.getString(R.string.type), "android");
    headers.putString(context.getString(R.string.source), "app");
    customTabsIntent.intent.putExtra(Browser.EXTRA_HEADERS, headers);
    customTabsIntent.intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    customTabsIntent.launchUrl(context, Uri.parse(url));
}

回答1:


Adding custom headers was removed due to being a vulnerability. CORS safe-listed request headers are still supported. You can read more about this change here: http://crbug.com/873178



来源:https://stackoverflow.com/questions/63168798/android-extra-headers-is-not-reflecting-in-updated-chrome-version-greater-than

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!