0

I am trying to load offline version of python documentation into an webview from assetfolder. The offline docs work perfectly in my pc web browser in offline but not working properly in webview (something like jquery is missing).

@SuppressLint("SetJavaScriptEnabled")
public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        WebView webView = (WebView) findViewById(R.id.wrapper);
        webView.getSettings().setJavaScriptEnabled(true);
        webView.setWebChromeClient(new WebChromeClient());
        webView.loadUrl("file:///android_asset/python/index.html");
    }

}

And this error message is shown when I tried to load the home page or navigate to any page.

09-24 01:03:02.789: E/Web Console(479): ReferenceError: Can't find variable: $ at file:///android_asset/python/index.html:164

What did I miss?

1
  • Not sure but usually thi smust work WebView webView = (WebView) findViewById(R.id.wrapper); webView.getSettings().setJavaScriptEnabled(true); webView.loadUrl("file:///android_asset/index.html");
    – khubaib
    Sep 23, 2013 at 18:18

1 Answer 1

0

Okay, This won't work as I intended to achieve like an phonegap app. I am working in Android plaform with Java. The webpages are now sohwig normally as like other android app.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.