title: Android webview not loading css and javascript when trying to access webpage using custom headers
body: <p>I am using authorization headers to access the web page, but when using WebViewClient with authorization headers the webview not rendering the css and also the js not loading.</p>
  
  <pre><code>    public class TableViewTest extends AppCompatActivity {
  
      WebView webView;
      SharedPreferences pref;
  
      @SuppressLint("SetJavaScriptEnabled")
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_table_view_test);
  
          String url = "http://myurl";
          pref = getSharedPreferences("app", Context.MODE_PRIVATE);
  
  
          webView = (WebView) findViewById(R.id.webView1Id);
  
          webView.setWebViewClient(wvc);
          //webView.setVerticalScrollBarEnabled(true);
          //webView.setHorizontalScrollBarEnabled(true);
          webView.getSettings().setJavaScriptEnabled(true);
          webView.getSettings().setBuiltInZoomControls(true);
          webView.getSettings().setDomStorageEnabled(true);
          webView.getSettings().setUseWideViewPort(true);
          if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.LOLLIPOP) {
              webView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_COMPATIBILITY_MODE);
              webView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
          }
          //webView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
  
          webView.loadUrl("http://myurl");
  
      }
  
  
      @Override
      protected void onSaveInstanceState(Bundle outState) {
          super.onSaveInstanceState(outState);
          webView.saveState(outState);
      }
  
      @Override
      protected void onRestoreInstanceState(Bundle savedInstanceState) {
          super.onRestoreInstanceState(savedInstanceState);
          webView.restoreState(savedInstanceState);
      }
  
  
      WebViewClient wvc = new WebViewClient() {
  
          @SuppressWarnings("deprecation")
          public WebResourceResponse shouldInterceptRequest(WebView view, String url) {
              try {
                  final String acToken = pref.getString("token", "DEFAULT");
  
                  OkHttpClient okHttpClient = new OkHttpClient();
                  Request request = new Request.Builder().url(url).addHeader("Authorization", "Bearer " + acToken)
                          .build();
  
                  Response response = okHttpClient.newCall(request).execute();
  
                  return new WebResourceResponse(response.header("text/html", response.body().contentType().type()), // You can set something other as default content-type
                          response.header("content-encoding", "utf-8"),  // Again, you can set another encoding as default
                          response.body().byteStream());
  
  
              } catch (ClientProtocolException e) {
                  //return null to tell WebView we failed to fetch it WebView should try again.
                  return null;
              } catch (IOException e) {
                  e.printStackTrace();
                  return null;
              }
          }
      };
  }
  </code></pre>
  
  <p>Please help me. Any help is appreciated.</p>