在所有浏览器上添加自定义标头 [英] Adding custom headers on all browsers

查看:167
本文介绍了在所有浏览器上添加自定义标头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个应用程序,我想在Android的浏览器中添加标题。它在Google Chrome上的工作情况还不错。

I am working on a application where i want to add headers to browser in android. Its working pretty fine on Google chrome.

但这不适用于其他可用的浏览器,例如Firefox,UC浏览器,OperaMini,海豚

But this is not working on other available browsers like Firefox, UC browser, OperaMini, Dolphin

以下是我尝试过的代码。

Below is the code that i tried.

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);

我们将不胜感激。感谢您。

Any help will be appreciated.Thanks in advance.

推荐答案

没有要求浏览器特别注意 EXTRA_HEADERS REQUEST_HEADER_TOKEN 等。

There is no requirement that browsers pay any attention to extras like EXTRA_HEADERS, REQUEST_HEADER_TOKEN, etc.

要么使用 WebView ,要么在不添加标题的情况下直接使用。

Either use WebView or live without the headers always being added.

这篇关于在所有浏览器上添加自定义标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆