Hello ppl i have created one android application using android webview. In the url that i have loaded in webview has print options in some place.
java code
WebSettings webSetting = webView.getSettings(); webSetting.setBuiltInZoomControls(true); webSetting.setJavaScriptEnabled(true); webView.addJavascriptInterface(new webAppInterface(this), "Android"); webView.setWebChromeClient(new WebChromeClient()); webView.getSettings().setLoadsImagesAutomatically(true); webView.setWebViewClient(new WebViewClient()); webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); webView.setWebViewClient(new WebViewClient() { @Override public void onPageStarted(WebView view, String url, Bitmap favion){ super.onPageStarted(view,url,favion); setProgressBarVisibility(View.VISIBLE); } @Override public void onPageFinished(final WebView view, String url) { //hide loading image //hide progressbar setProgressBarVisibility(View.GONE); //show webview // doWebViewPrint(); } }); if(cm != null && cm.getActiveNetworkInfo() != null && cm.getActiveNetworkInfo().isConnected()){ webView.loadUrl("://site/"); webView.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT); webView.setWebViewClient(new MyBrowser(){ public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { webView.getSettings().setAllowFileAccess(true); webView.loadUrl("file:///android_asset/first.html"); } }); } else{ webView.getSettings().setAllowFileAccess(true); webView.loadUrl("file:///android_asset/first.html"); webView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); } registerReceiver(broadcastReceiver, new IntentFilter("INTERNET_LOST")); }
Asp.net Javascript
<script language="javascript" type="text/javascript"> function PrintPage3() { var printContent = document.getElementById('<%= noder.ClientID %>'); var printWindow = window.open("All Records", "Print Panel", 'left=50000,top=50000,width=120%,height=0'); printWindow.document.write(printContent.innerHTML); printWindow.document.close(); printWindow.focus(); printWindow.print(); } </script>
when html button is click, the webview display Server Error 404- File or directory not found.
but when i visited the site from google chrome it works fine.