Rahul Matte
Rahul Matte

Reputation: 1181

Android webview not loading complete html page with included resources

I am trying to load login.html in webview with help of webview's loadUrl("http://xyc.com/login.html") The html page has following tags

<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>Hello </title>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <!--CSS linking -->
    <link rel="stylesheet" href="assets/css/jquery.mobile-1.4.2.css" />
    <link rel="stylesheet" href="assets/css/jquery-ui.css">
    <link rel="stylesheet" href="assets/css/custom.css" />
</head>
<body>
<!-- jquery DOM element goes here-->
</body>
<!--Javascript linking -->
<script src="assets/js/jquery-1.9.1.js"></script>
<script src="assets/js/jquery-ui.js"></script>
<script src="assets/js/jquery.mobile-1.4.2.js"></script>
</html>

The methods in jQuery mobile doesn't work consistently, I am wondering whether it is because of timing issue while loading jquery and jquery-mobie plugins inside html page or it's bug in Android 4.3 webview. It's happening only in Adroid 4.2 & 4.3 webview. Android logcat shows below errors

E/Web Console﹕ Uncaught TypeError: Object #<Object> has no method 'remove':12079
E/Web Console﹕ Uncaught TypeError: Object #<Object> has no method 'not':740
E/Web Console﹕ Uncaught TypeError: Object #<Object> has no method 'children':528

Upvotes: 2

Views: 864

Answers (1)

Ahmad Aghazadeh
Ahmad Aghazadeh

Reputation: 17131

You test This code :

   <link rel="stylesheet" href="file:///android_asset/js/jquery.mobile-1.4.2.css">
   <script src="file:///android_asset/js/jquery.js"></script>
   <script src="file:///android_asset/js/jquery.mobile-1.4.2.js"></script>

Or use :

   <script>
      javascript:loadScript('file:///android_asset/jquery.js','callback')
   </script>

Upvotes: 1

Related Questions