简体   繁体   中英

On fetch() nothing is happening

Here's a WebView which loads a page with triggers a fetch() on a button click. The html is fine and the page is working in the browser. However the WebView does nothing on click.

override fun onCreate(savedInstanceState: Bundle?) {
  var mWebView = findViewById(R.id.activity_main_webview) as WebView
  var webSettings = mWebView.getSettings()
  webSettings.setDomStorageEnabled(true)
  webSettings.setJavaScriptEnabled(true)
  webSettings.setLoadWithOverviewMode(true)
  mWebView.webViewClient = WebViewClient()
  mWebView.loadUrl("https://example.com")
}

The error in the debugging console in Android Studio is:

E/chromium: [ERROR:ssl_client_socket_impl.cc(959)] handshake failed; returned -1, SSL error code 1,.net_error -200 I/chromium: [INFO:CONSOLE(0)] "Uncaught (in promise) TypeError: Failed to fetch", source: https://example.com/ (0)

What is the cause?

As mentioned before and for the lack of a better answer:

I found the answer here: Android WebView not loading an HTTPS URL by @robnick. It works in development.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM