2017-11-19 1 views
1

수 없습니다를로드하지 -웹보기 지금까지 다음과 같은 시도 <p><a href="https://6awlanow.com/about/faqs" rel="nofollow noreferrer">https://6awlanow.com/about/faqs</a></p> <p>웹보기</p>에 다음과 같은 웹 페이지를로드하는 특정 페이지

webView.getSettings().setJavaScriptEnabled(true); 
    webView.getSettings().setLoadWithOverviewMode(true); 
    webView.getSettings().setUseWideViewPort(true); 
    webView.getSettings().setPluginState(WebSettings.PluginState.ON); 
    webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); 
    webView.getSettings().setAllowFileAccess(true); 
    webView.getSettings().setDomStorageEnabled(true); 
    webView.getSettings().setUserAgentString("Android WebView"); 
    webView.setWebViewClient(new WebViewClient() { 

     @Override 
     public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) { 
     view.loadUrl(request.getUrl().getPath()); 
     //if (progressDialog != null && progressDialog.isShowing()) { 
     // progressDialog.dismiss(); 
     //} 
     return true; 
     } 

     //If you will not use this method url links are opeen in new brower not in webview 
     @Override 
     public boolean shouldOverrideUrlLoading(WebView view, String url) { 
     view.loadUrl(url); 
     return true; 
     } 

     //Show loader on url load 
     @Override 
     public void onLoadResource(WebView view, String url) { 
     } 
     @Override 
     public void onPageFinished(WebView view, String url) { 
     try { 
      //if (progressDialog.isShowing()) { 
      // progressDialog.dismiss(); 
      //} 
     } catch (Exception exception) { 
      exception.printStackTrace(); 
     } 
     } 

     @Override 
     public void onReceivedError(
     WebView view, WebResourceRequest request, WebResourceError error 
    ) { 
     //progressDialog.dismiss(); 
     super.onReceivedError(view, request, error); 
     } 

    }); 

이미 인터넷을 권한을 제공하고 있습니다. URL은 WebView를 제외하고 어디서나 잘로드됩니다. 내가 오류 다음 얻을 -

내 콘솔에서 정보를 다음과 같은 가져 오기 - 코드 아래

I: [INFO:CONSOLE(31)] "Uncaught TypeError: Object.assign is not a function", source: https://6awlanow.com/app.c98a13d5a9fdd32775ca.js (31) 
I: [INFO:CONSOLE(0)] "Error: Invalid negative value for <rect> attribute ry="-.125"", source: https://6awlanow.com/about/faqs (0) 
I: [INFO:CONSOLE(0)] "Error: Invalid negative value for <rect> attribute ry="-.125"", source: https://6awlanow.com/about/faqs (0) 
I: [INFO:CONSOLE(0)] "Error: Invalid negative value for <rect> attribute ry="-.125"", source: https://6awlanow.com/about/faqs (0) 
I: [INFO:CONSOLE(0)] "Error: Invalid negative value for <rect> attribute ry="-.125"", source: https://6awlanow.com/about/faqs (0) 
I: [INFO:CONSOLE(0)] "Error: Invalid negative value for <rect> attribute ry="-.125"", source: https://6awlanow.com/about/faqs (0) 
I: [INFO:CONSOLE(0)] "Error: Invalid negative value for <rect> attribute ry="-.125"", source: https://6awlanow.com/about/faqs (0) 
I: [INFO:CONSOLE(0)] "Error: Invalid negative value for <rect> attribute ry="-.125"", source: https://6awlanow.com/about/faqs (0) 
I: [INFO:CONSOLE(0)] "Error: Invalid negative value for <rect> attribute ry="-.125"", source: https://6awlanow.com/about/faqs (0) 
I: [INFO:CONSOLE(0)] "Error: Invalid negative value for <rect> attribute ry="-.125"", source: https://6awlanow.com/about/faqs (0) 
I: [INFO:CONSOLE(0)] "Error: Invalid negative value for <rect> attribute ry="-.125"", source: https://6awlanow.com/about/faqs (0) 
I: [INFO:CONSOLE(0)] "Error: Invalid negative value for <rect> attribute ry="-.125"", source: https://6awlanow.com/about/faqs (0) 
I: [INFO:CONSOLE(0)] "Error: Invalid negative value for <rect> attribute ry="-.125"", source: https://6awlanow.com/about/faqs (0) 
+0

이전 버전 기기에서 테스트 하시겠습니까? –

+0

@IntelliJAmiya 아니요, Lollipop 기기에서 테스트 중입니다. –

+0

@IntelliJAmiya 여전히 동일한 문제 –

답변

2

사용하고 그것을 작동합니다, 나는 시험하고 일했다.

public class WebViewEx extends AppCompatActivity { 

    private WebView webView; 
    private ProgressDialog progDailog; 
    Activity activity; 


    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.activity_web_view_ex); 

     webView = findViewById(R.id.webView); 
     activity = this; 

     progDailog = ProgressDialog.show(activity, "Loading", "Please wait...", true); 
     progDailog.setCancelable(false); 


     webView.getSettings().setJavaScriptEnabled(true); 
     webView.getSettings().setLoadWithOverviewMode(true); 
     webView.getSettings().setUseWideViewPort(true); 
     webView.getSettings().setDomStorageEnabled(true); 
     webView.setWebChromeClient(new WebChromeClient()); 
     webView.setWebViewClient(new WebViewClient() { 

      @Override 
      public boolean shouldOverrideUrlLoading(WebView view, String url) { 
       progDailog.show(); 
       view.loadUrl(url); 

       return true; 
      } 

      @Override 
      public void onPageFinished(WebView view, final String url) { 
       progDailog.dismiss(); 
      } 
     }); 

     webView.loadUrl("https://6awlanow.com/about/faqs"); 
    } 
} 

당신의 XML은 다음과 같이 될 것입니다 : 아래

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical"> 

    <WebView 
     android:id="@+id/webView" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" /> 

</LinearLayout> 

내가 웹보기에서 얻은 결과입니다

나는이 문제를 해결 알려 주시기 바랍니다 enter image description here

검색어가 있으면 알려주세요.

+0

이상하게 들리지만로드 된 URL은 정확합니다. 그러나 여전히로드되지 않습니다. 이 URL을 제외한 나머지 URL은 계속로드됩니다. 나는 약간 시간 안에 관련 코드를 가진 GitHub에 프로젝트를 창조 할 것이다. 그럼 한번보세요. –

+0

@RohanKandwal이 나와 링크를 공유하고 나면 모양을 알아보고 문제가 무엇인지 알아볼 것입니다. –

+0

저장소를 찾으십시오. https://github.com/rohankandwal/webview –

관련 문제