zoukankan      html  css  js  c++  java
  • android 5.0 webview坑

    http://www.heapoverflow.me/question-webview-loadurlurl-headers-not-working-in-android-31203905

    It's beceause of Cookie Policy, to fix it, you should add this :

    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        super.init();
    
        // Allow third party cookies for Android Lollipop
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            WebView webView = (WebView)super.appView;
            CookieManager cookieManager = CookieManager.getInstance();
            cookieManager.setAcceptThirdPartyCookies(webView,true);
        }
    
        super.loadUrl(Config.getStartUrl());
    }
    
    5
    user2906641 Posted at 2015-07-27 07:51:35Z

    if you are using Android Lollipop, then

    CookieManager.getInstance().setAcceptCookie(true);
    

    won't work. You need to use

    CookieManager.getInstance().setAcceptThirdPartyCookies(true);
  • 相关阅读:
    C语言之回调函数&模块化
    680. 验证回文字符串 Ⅱ
    C++指针数组和数组指针
    345. 反转字符串中的元音字母
    633.平方数之和
    IDM使用介绍篇
    路由器无线桥接WDS
    约数的个数
    密码翻译
    查找学生信息
  • 原文地址:https://www.cnblogs.com/wanqieddy/p/4963576.html
Copyright © 2011-2022 走看看