2013年7月19日星期五

android how to implement the server side html, js, css on the client

Such as the title, because the various pages on the server side, but they often do not want to download the same js, although there webview js caching mechanism.
So, now just want to js on the client, the online test some methods are useless.
For example on this page add: <script src="android.resource://com.example.sample/raw/js_script">

Do not know anyone who tried, for help
--------- Solution
webView.setWebViewClient (new WebViewClient ()
{
             @ Override
             public void onPageFinished (WebView view, String url)
             {
             super.onPageFinished (view, url);
             }
             @ Override
             public void onPageStarted (WebView view, String url, Bitmap favicon)
             {
             webView.loadUrl ("javascript: function a () {alert (1)}");
                 super.onPageStarted (view, url, favicon);
             }
           
         
});

没有评论:

发表评论