Snapchat网址加载问题 [英] Snapchat Url load issue

查看:371
本文介绍了Snapchat网址加载问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已在我的Android应用程序中将关注我们"整合到Snapchat上,因此正在显示 https://www我的默认网络视图中的.snapchat.com/add/danubeco 网址.在Google Chrome浏览器中可以正常运行,但无法在设备的默认浏览器中加载.这是在Web视图中尝试出现的错误-未捕获的TypeError:Array.from不是函数",来源:

I have integrated Follow us on Snapchat in my Android application and for that am displaying https://www.snapchat.com/add/danubeco URL in my default web view. This works fine in the Google Chrome but fails to load in the default browser of the device. Here is the error which am getting on trying in the web view - "Uncaught TypeError: Array.from is not a function", source: https://www.snapchat.com/deeplink/static/js/sc-web-frame.js. I have tried in the several devices and found the same, but the thing is that it works totally fine in IOS. I have attached the screenshot of the web view with the error. Please suggest the way through which I can cope up from the issue.

屏幕快照中显示的URL-snapchat://add/danubeco?sc_referrer =& link =%2Fadd%2Fdanubeco& sc_ua = Mozilla%2F5.0 +%28Linux%3B + Android + 6.0%3B + Android + SDK + build + for + x86 + Build%2FMASTER%3B + wv%29 + AppleWebKit%2F537.36 +%28KHTML%2C + like + Gecko%29 + Version%2F4.0 + Chrome%2F44.0.2403.119 + Mobile + Safari%2F537.36& cid = b69e8a19-adf5-4209-9600-a26c0d5e0485

URL shown in the screenshot - snapchat://add/danubeco?sc_referrer=&link=%2Fadd%2Fdanubeco&sc_ua=Mozilla%2F5.0+%28Linux%3B+Android+6.0%3B+Android+SDK+built+for+x86+Build%2FMASTER%3B+wv%29+AppleWebKit%2F537.36+%28KHTML%2C+like+Gecko%29+Version%2F4.0+Chrome%2F44.0.2403.119+Mobile+Safari%2F537.36&cid=b69e8a19-adf5-4209-9600-a26c0d5e0485

我只是以xml的形式查看Web视图,并在Java类的代码下面编写了代码.

I have simply taken web view in xml and written below code in java class.

webView = (WebView) root.findViewById(R.id.webView);
webView.setKeepScreenOn(true);
webView.getSettings().setLoadsImagesAutomatically(true);
webView.getSettings().setDomStorageEnabled(true);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setLoadWithOverviewMode(true);
webView.getSettings().setUseWideViewPort(true);
webView.getSettings().setBuiltInZoomControls(true);
webView.getSettings().setSupportZoom(true);
webView.setWebViewClient(new MyWebClient());
webView.loadUrl(url);

任何帮助都是有意义的.

Any sort of help would be appreciable.

谢谢.

推荐答案

尝试将此不加载url放在ShouldOverrideUrlLoading上,并为false设置条件,这是完美的方法

   WebSettings settings = webview.getSettings();
    settings.setJavaScriptEnabled(true);
    //ws.setJavaScriptEnabled(true);
    settings.setJavaScriptCanOpenWindowsAutomatically(true);
    webview.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);



webview.setWebViewClient(new WebViewClient() {

        public boolean shouldOverrideUrlLoading(WebView view, String url) {


            if( url.startsWith("http:") || url.startsWith("https:") ) {
                return false;
            }
          //  Log.i(TAG, "Processing webview url click..."+url);
         //  view.loadUrl(url);

            return true;
        }


        public void onPageFinished(WebView view, String url) {
            Log.e(TAG, "Finished loading URL: " + url);
            if (progressBar.isShowing()) {
                progressBar.dismiss();
            }


        }


        public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {



        }
    });

    webview.loadUrl("https://www.snapchat.com/add/danubeco");

这篇关于Snapchat网址加载问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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