android - 在所有浏览器上添加自定义 header

标签 android firefox android-intent browser custom-headers

我正在开发一个应用程序,我想在其中向 android 中的浏览器添加 header 。它在谷歌浏览器上运行良好。

但这不适用于其他可用的浏览器,如 Firefox、UC 浏览器、OperaMini、Dolphin

下面是我试过的代码。

Intent mIntent = new Intent(Intent.ACTION_VIEW,Uri.parse(URL));
Bundle bundle = new Bundle();
bundle.putString(Constants.REQUEST_HEADER_TOKEN, "token");
bundle.putString(Constants.REQUEST_HEADER_AUTH, "Basic bfjdslfs");
mIntent.putExtra(Browser.EXTRA_HEADERS, bundle);
startActivity(mIntent);

如有任何帮助,我们将不胜感激。在此先致谢。

最佳答案

不要求浏览器注意 EXTRA_HEADERSREQUEST_HEADER_TOKEN 等额外内容

要么使用 WebView,要么始终不添加 header 。

关于android - 在所有浏览器上添加自定义 header ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38438069/

相关文章:

android - 如何从 ListView 中获取选定的值以显示在第二个 Activity 中?

android - 有没有办法以编程方式在 google play 开发者控制台上获取评论?

android - 搜索开始新 Activity 时如何结束旧 Activity

javascript - 如何将 Firefox 插件的本地存储空间增加到无限?

android - 从android中的通话记录中访问最近错过的号码

使用 Zxing 的 Android 条码扫描器

android - 当我取消它时, toast 可以再次显示吗

android - 如何样式化 (CSS) 由 Android 应用程序 (Intent) 创建的电子邮件的 HTML 正文?

Javascript try-catch 错误输出被 chop