<tfoot id='mtwgw'></tfoot>
  1. <small id='mtwgw'></small><noframes id='mtwgw'>

      <bdo id='mtwgw'></bdo><ul id='mtwgw'></ul>
    1. <i id='mtwgw'><tr id='mtwgw'><dt id='mtwgw'><q id='mtwgw'><span id='mtwgw'><b id='mtwgw'><form id='mtwgw'><ins id='mtwgw'></ins><ul id='mtwgw'></ul><sub id='mtwgw'></sub></form><legend id='mtwgw'></legend><bdo id='mtwgw'><pre id='mtwgw'><center id='mtwgw'></center></pre></bdo></b><th id='mtwgw'></th></span></q></dt></tr></i><div id='mtwgw'><tfoot id='mtwgw'></tfoot><dl id='mtwgw'><fieldset id='mtwgw'></fieldset></dl></div>
      <legend id='mtwgw'><style id='mtwgw'><dir id='mtwgw'><q id='mtwgw'></q></dir></style></legend>

    2. 如何在 webView 的 url 中发送引用请求

      How to send a referer request in a url for a webView(如何在 webView 的 url 中发送引用请求)

      <small id='mQAbj'></small><noframes id='mQAbj'>

          <bdo id='mQAbj'></bdo><ul id='mQAbj'></ul>

              • <legend id='mQAbj'><style id='mQAbj'><dir id='mQAbj'><q id='mQAbj'></q></dir></style></legend>

                  <tbody id='mQAbj'></tbody>
                <tfoot id='mQAbj'></tfoot>
                <i id='mQAbj'><tr id='mQAbj'><dt id='mQAbj'><q id='mQAbj'><span id='mQAbj'><b id='mQAbj'><form id='mQAbj'><ins id='mQAbj'></ins><ul id='mQAbj'></ul><sub id='mQAbj'></sub></form><legend id='mQAbj'></legend><bdo id='mQAbj'><pre id='mQAbj'><center id='mQAbj'></center></pre></bdo></b><th id='mQAbj'></th></span></q></dt></tr></i><div id='mQAbj'><tfoot id='mQAbj'></tfoot><dl id='mQAbj'><fieldset id='mQAbj'></fieldset></dl></div>
              • 本文介绍了如何在 webView 的 url 中发送引用请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我需要在我的 Android 应用程序中显示一个网页,该网页正在寻找引用者以绕过安全性.我是 Android 新手,所以我知道如何在 Web 视图中显示网页,但不知道如何将引荐来源"与 url 请求一起发送.我确定它需要更新 HTTPHeaderField 但我在 Android 中找不到任何参考.下面的代码是我用来调出网页的代码,但没有引用者",它会显示拒绝访问"

                I need to display a web page in my Android app which is looking for a referer to bypass the security. I'm new to Android so I know how to display the web page in a web view but not how to send the 'referer' along with the url request. I'm sure it will need to update the HTTPHeaderField but I cannot find any reference for it in Android. The code below is what I'm using to bring up the web page but without the 'referer' it says 'Access Denied'

                WebView webview = new WebView(this);
                setContentView(webview);
                webview.loadUrl("http://www.mywebsite.com");
                

                我认为答案可能在于添加额外标题的 WebView.LoadURL 方法,但我找不到任何示例.

                I think the answer may lie in the WebView.LoadURL method which adds extra headers but I can't find any examples of it.

                推荐答案

                对于哪个 API 级别需要该函数?

                For which API-level do you need that function?

                从 API Level 8 开始,有第二个 loadUrl 函数:

                Since API Level 8 there is a second loadUrl function:

                  public void loadUrl (String url, Map<String, String> extraHeaders)
                

                使用 extraHeaders 您应该能够发送推荐人.

                With the extraHeaders you should be able to send a referrer.


                这是一个完整的工作示例:

                Here is a complete working example:

                  String url = "http://www.targetserver.tld/";
                
                  Map<String, String> extraHeaders = new HashMap<String, String>();
                  extraHeaders.put("Referer", "http://www.referer.tld/login.html");
                
                  WebView wv;
                  wv = (WebView) findViewById(R.id.webview);
                  wv.loadUrl(url, extraHeaders);
                

                这篇关于如何在 webView 的 url 中发送引用请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                How to use NSURLSession to determine if resource has changed?(如何使用 NSURLSession 来判断资源是否发生了变化?)
                What header should be used for sending GZIP compressed JSON from Android Client to Server?(应该使用什么标头将 GZIP 压缩 JSON 从 Android 客户端发送到服务器?)
                UIWebView capturing the response headers(UIWebView 捕获响应标头)
                Android : Capturing HTTP Requests with non-rooted android device(Android : 使用非 root 的 android 设备捕获 HTTP 请求)
                Specifying HTTP referer in embedded UIWebView(在嵌入式 UIWebView 中指定 HTTP 引用)
                Maintaining session in android ( application stay authenticated on the server side)(在android中维护会话(应用程序在服务器端保持身份验证))
              • <tfoot id='RhbaB'></tfoot>

                <small id='RhbaB'></small><noframes id='RhbaB'>

                  <i id='RhbaB'><tr id='RhbaB'><dt id='RhbaB'><q id='RhbaB'><span id='RhbaB'><b id='RhbaB'><form id='RhbaB'><ins id='RhbaB'></ins><ul id='RhbaB'></ul><sub id='RhbaB'></sub></form><legend id='RhbaB'></legend><bdo id='RhbaB'><pre id='RhbaB'><center id='RhbaB'></center></pre></bdo></b><th id='RhbaB'></th></span></q></dt></tr></i><div id='RhbaB'><tfoot id='RhbaB'></tfoot><dl id='RhbaB'><fieldset id='RhbaB'></fieldset></dl></div>
                    <tbody id='RhbaB'></tbody>

                          <bdo id='RhbaB'></bdo><ul id='RhbaB'></ul>
                          <legend id='RhbaB'><style id='RhbaB'><dir id='RhbaB'><q id='RhbaB'></q></dir></style></legend>