I made a url to open through webview and everything worked fine for me except some buttons of the webpage it doesn't respond anything
public class browse extends AppCompatActivity {
WebView appwebview;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_browse);
String profileID= getIntent().getStringExtra("inputtext");
Toast.makeText(getApplicationContext(),profileID,Toast.LENGTH_SHORT).show();
appwebview=(WebView) findViewById(R.id.webview);
WebSettings webSettings= appwebview.getSettings();
webSettings.getJavaScriptEnabled();
appwebview.loadUrl("https://statsroyale.com/profile/"+profileID);
appwebview.setWebViewClient(new WebViewClient());
}
@Override
public void onBackPressed() {
if(appwebview.canGoBack())
appwebview.goBack();
else
super.onBackPressed();
}
}
the intent passes text of textfield from MainActivity and depending on that text i used to show profile.
Probably you forgot to activate Javascript in the WebView.
Please try this:
webSettings.setJavaScriptEnabled(true);
instead of:
webSettings.getJavaScriptEnabled();
A couple of other settings could help:
settings.setLoadWithOverviewMode(true);
settings.setUseWideViewPort(true);
settings.setAllowFileAccess(true);
settings.setAllowContentAccess(true);
settings.setAllowFileAccessFromFileURLs(true);
settings.setAllowUniversalAccessFromFileURLs(true);
settings.setDomStorageEnabled(true);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With