html5 - Javascripts wont execute in Android webview -


i have created web app using query mobile , html5 , currently, none of js executes in application.

js enabled on android webview jquery mobile can execute js library not work on android device.

it works fine on ios simulator , on web browser wondering if there kind of hidden settings/implementation need handle android?

here error receive onclick event on simple dialog html outputted using phone gap

07-15 09:25:00.621: e/web console(2992): uncaught referenceerror: uploadtrue not defined @ file:///android_asset/www/itemdetailcarhire.html:2 

here itemdetailcarhire html launches dialog executes onclick.

<!doctype html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> <title></title> <link href="src/jquery.mobile-1.3.1.min.css" rel="stylesheet" type="text/css"/> <link rel="stylesheet" href="src/jquery.mobile.iscrollview.css" /> <link rel="stylesheet" href="src/jquery.mobile.iscrollview-pull.css" /> <script src="src/jquery-1.9.1.min.js" type="text/javascript"></script> <script src="src/jquery.mobile-1.3.1.min.js" type="text/javascript"></script>  <script src="src/iscroll.js"></script> <script src="src/jquery.mobile.iscrollview.js"></script> <script src="src/script/itemdetailcarhire.js"></script>    <link rel="stylesheet" href="src/jquery.ui.datepicker.mobile.css" />    <script src="src/jquery.ui.datepicker.js"></script>   <script src="src/jquery.ui.datepicker.mobile.js"></script>   </head>  <body> <div data-role="page" id="fields">   <div data-role="header" data-position="fixed" data-theme="b" data-tap-toggle="false" data-transition="none" > <a href="" onclick="history.back(-1); return false;">back</a>     <h1>new claim</h1>   </div>   <div data-role="content">     <ul class="ui-li" data-role="listview" id="claimprofilelistview" data-inset="true"  data-scroll="true">          <h3>original receipt:</h3>         <div data-role="fieldcontain"> <a href="uploadrecieptdialog.html" data-role="button" data-rel="dialog">upload reciept</a> </div>       </li>      </ul>     <div data-role="navbar">       <ul>         <li><a href="claimitemsummary.html" data-theme="b">save claim item</a></li>       </ul>     </div>   </div> </div> </body> </html> 

when user clicks original receipt component, correctly display dialog called uploadrecieptdialog.html , code below:

<!doctype html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> <title></title> <link href="src/jquery.mobile-1.3.1.min.css" rel="stylesheet" type="text/css"/> <link rel="stylesheet" href="src/jquery.mobile.iscrollview.css" /> <link rel="stylesheet" href="src/jquery.mobile.iscrollview-pull.css" />  <script src="src/jquery-1.9.1.min.js" type="text/javascript"></script> <script src="src/jquery.mobile-1.3.1.min.js" type="text/javascript"></script> <script src="src/iscroll.js"></script> <script src="src/jquery.mobile.iscrollview.js"></script>    </head> <body> <div data-role="page" id="page">  <div data-role="header"  data-theme="b"  data-position="fixed" >          <h1>upload reciept</h1>      </div>   <div data-role="content">   <p>click button below select , upload reciept</p>     <h3><a onclick="uploadtrue();" data-role="button" data-theme="c" >upload reciept</a></h3>      <div data-role="footer" data-position="fixed" data-theme="b" >      </div>   </div> </div> </body> </html> 

here updatedetailcarhire.js

function uploadtrue(){         alert("upload true");          //load previous page         history.back(-1); return false;         alert("uploaded");      } 

a simple js can see displays alert message , goes previous screen. on ios simulator , chrome/safari desktop web browser, works!

i'm guessing javascript isn't executing because cordova having problem history command.

check here: in cordova 1.8.1 - android history.back() not working

and possibly: why javascript:history.go(-1); not working on mobile devices?

try using history.back();

edit: don't see updatedetailcarhire.js being included on of html pages.


Comments