android - Javascript acting differently in inappbrowser vs Chrome - Undefined global variables -


my problem when use inappbrowser open web page, main javascript file seems ignored, though referenced in head of file opening using ref = cordova.inappbrowser.open('https://myurlhere:8484/home/login', '_self', 'location=yes');

i using chrome://inspect/#devices inspect console , errors when hitting buttons.. referenced in main.js file undefined.. whereas actual code autocomplete , button seems executing.

please note url working fine when viewed in chrome browser. javascript files seem load correctly, , variables defined correctly. - when use inappbrowser see issues undefined variables.

my code (cordova app):

ref = cordova.inappbrowser.open('https://myurlhere:8484/home/login', '_self', 'location=yes');     var myinappbrowsercallback = function(event) {          console.log(event.url, 'loaded');      };     ref.addeventlistener('loadstart', myinappbrowsercallback); //works fine. 

my code (from actual website i'm trying view in inappbrowser):

<script src="/scripts/commonfunctions.js"></script> var p = 'hello';  <script src="/scripts/loginpage.js"></script> $('#btnlogin').on('click', function() {     alert(p); }); 

returns alert undefined.

what have tried:

  1. extensive googling! (all answers seem related javascript not being enabled.. or 404 errors or things that.. not global variables 1 js file being undefined in js file.)
  2. removing inappbrowser, using window.open.. won't work app needs execute scripts inspect localstorage of site.
  3. re-installing android platform using cordova.
  4. re-installing plugin.
  5. checking chrome in inspector ensure files in sources tab (they are).
  6. checking functions in main.js exist (they do).

thanks, jfit

summary: problem javascript file trying load 'speechsynthesis' undefined in inappbrowser.

details:

the problem confusing here steps found debug / solve:

  1. set remote debugging on phone can view console of phone using chrome://inspect/#devices

  2. view console of inappbrowser site (which show seperate page inappbrowser instance.

  3. identify files being loaded , remove files until 'undefined' errors disappear.

  4. add in recent file , start strip out various functions (especially functions/variables before document.ready (global variables also)

  5. find line/variable way. handy me way actual undefined variable showed after removed of files.

  6. the actual cause of error speechsynthesis functionality.

the speechsynthesis lines removed, , readded remaining files , works. function works fine in chrome on desktop/android not in inappbrowser.


Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

transpose - Maple isnt executing function but prints function term -