android-webview

Javascript injection into webview

半城伤御伤魂 提交于 2019-12-19 07:39:46
问题 I know it exists a lot of questions about that but i don't understand why my following code does not work anymore Here is my code : private void init() { webview.setWebViewClient(new FormWebViewClient()); webview.postUrl(url, EncodingUtils.getBytes(data, "BASE64")); } private class FormWebViewClient extends WebViewClient { @Override public void onPageStarted(WebView view, String url, Bitmap favicon) { super.onPageStarted(view, url, favicon); // progressBar.setVisibility(View.VISIBLE); }

DownloadListener.onDownloadStart() never called

十年热恋 提交于 2019-12-19 07:27:34
问题 In my attempts to create a WebView that plays YouTube videos via HTML5 (and not via Flash), I tried to implement this article verbatim, right inside my activity's onCreate(): WebView webView = (WebView) findViewById(R.id.embeddedWebView); webView.setDownloadListener(new DownloadListener() { public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimeType, long size) { Log.v("TAG", "url: " + url + ", mimeType: " + mimeType); Intent viewIntent = new Intent

Android: Logcat is not working for JS console.log()

可紊 提交于 2019-12-19 06:54:14
问题 My app is a combination of Android native, html5. Till last week I'm able to see the log messages from native code and javascript code running inside th WebView. But suddenly Logcat is not showing the console messages from javascript, though it is showing Log messages from my native code. Any ideas? Thanks in advance. Venkat 回答1: You can try adding a console message handler to your WebView by creating your custom WebChromeClient: class MyWebChromeClient extends WebChromeClient { @Override

To View a web page inside your app?

↘锁芯ラ 提交于 2019-12-19 04:49:08
问题 I needed to build an Android app that lets you view a web page inside my app. I needed this not to be in a browser but my app. I found the answer and some options for when page is loaded. I thought I'd try sharing the info I found here, after I tested of course..... 回答1: First need to add INTERNET permission to your manifest. <uses-permission android:name="android.permission.INTERNET" /> Then, use the WebView class to display a web page. First, create a layout that contains a webview: <?xml

Android webView Load in Background

一笑奈何 提交于 2019-12-19 04:09:58
问题 I have an app which i want to open a webview right now i am loading the webview the most simple way i would like to load the webpage in the background so the user will not have a waiting time maybe in a service running in the background or in a prevoius activity i looked around the forums and could not find a refrence to the subject help will be appriciated. Thx 回答1: I hade the same problem a while ago, I know what you want. Asynctask! here is a good link I read on to get it to work! http:/

Disabling caching, cookies and everything else in a WebView

帅比萌擦擦* 提交于 2019-12-19 03:15:10
问题 I have a webservice that I am trying to authenticate with in the background using a webview. When I initially send the request it will work appropriately (failure/success based on credentials), but after it seems like I am getting a cached response. Here is my webview setup code: WebView browser = new WebView(this); WebSettings settings = browser.getSettings(); settings.setJavaScriptEnabled(true); settings.setSavePassword(false); settings.setCacheMode(WebSettings.LOAD_NO_CACHE); settings

WebView user agent

痞子三分冷 提交于 2019-12-19 03:11:29
问题 I have WebView which loads one mobile site, I need send to user agent to the server how it to realize? mWebView = (WebView) findViewById(R.id.webview); mWebView.getSettings().setJavaScriptEnabled(true); mWebView.loadUrl("http://searchmp3.mobi/"); mWebView.setWebViewClient(new HelloWebViewClient()); 回答1: Checkout the setUserAgentString() method in the WebSettings, e.g. mWebView.getSettings().setUserAgentString("My user agent string, here"); 回答2: try this one WebView wv = (WebView) findViewById

To show a static html page in android

守給你的承諾、 提交于 2019-12-18 19:01:23
问题 I am trying to show an html file in my assets folder but in web view i am seeing white blank page. I got similar example from stackflow only. public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); final String mimeType="text/html"; final String encoding="UTF-8"; String htmlString="<html><body>"; Document doc; WebView wv= new WebView(this); Elements link = null; setContentView(wv); try{ InputStream in=getAssets().open("myweb.html");

How to load web view in dialoge in android

空扰寡人 提交于 2019-12-18 18:23:07
问题 I am trying to load web view in to dialog. I am usuing the following code. final TextView seeMonthlyBill = (TextView) parentLayout .findViewById(R.id.my_ac_my_service_timewarnercable_link); seeMonthlyBill.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Dialog dialog = new Dialog(getActivity()); WebView wb = new WebView(getActivity()); wb.getSettings().setJavaScriptEnabled(true); wb.loadUrl("http://www.google.com"); wb.setWebViewClient(new HelloWebViewClient(

WebView blocking pop up windows?

安稳与你 提交于 2019-12-18 18:04:21
问题 I'm using WebView to browse pesopay.com and it works properly, except when I pressed the submit button. Using internet browsers like Google Chrome will show a pop up window, it confirms the information you filled. But in my Android WebView nothing happened when I pressed the submit button. I think because WebView is not enabled to display a pop up window. Can anyone point me what is wrong? Here is my activity: public class PaymentActivity extends Activity { String amount1; @SuppressLint(