Category : webview

My main class: package edu.temple.webbrowser; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentTransaction; import android.content.Context; import android.os.Bundle; import android.util.AttributeSet; import android.view.View; import android.view.WindowManager; import android.widget.Toast; public class BrowserActivity extends AppCompatActivity implements PageControlFragment.SendURLInterface, PageControlFragment.goBackInterface, PageControlFragment.goNextInterface, PageViewerFragment.SetURLInterface, PageViewerFragment.resetUrlInterface { PageControlFragment PCFrag = new PageControlFragment(); PageViewerFragment PVFrag; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); setTitle("Browser ..

Read more

I am trying to load the cached version of the website when mobile internet is off. But I am only getting a white screen. Here is my code. binding.webView.getSettings().setJavaScriptEnabled(true); binding.webView.getSettings().setDomStorageEnabled(true); binding.webView.getSettings().setAppCacheEnabled(true); binding.webView.getSettings().setAllowFileAccess(true); binding.webView.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT); binding.webView.getSettings().setAppCachePath(getApplicationContext().getCacheDir().getAbsolutePath()); if (!isNetworkAvailable()) { binding.webView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ONLY); } binding.webView.setWebChromeClient(new WebChromeClient()); binding.webView.setWebViewClient(new WebViewClient() { @Override public void onPageStarted(WebView view, String url, Bitmap favicon) { binding.progressBar.setVisibility(View.VISIBLE); ..

Read more

In my app, I download and save a file to my app’s cache directory (e.g. file:///data/user/0/…/cache/5f8f…/downloaded.pdf) and try to open this file using WebView. My WebView code is: <WebView source={{ uri: file.uri }} startInLoadingState originWhitelist={[‘file://’]} allowUniversalAccessFromFileURLs={true} allowFileAccess={true} /> On iOS, it works fine. However, on Android, it prints ERR_ACCESS_DENIED. I’ve tried some solutions found on ..

Read more