Cordova InappBrowser CallBack function of executeScript not calls for some URLs

720 Views Asked by At

I am working on a Cordova Ionic Mobile App. I am loading some urls in InappBrowser and injects some javascript codes using a timer. It returns the result data through the call back function. But for some urls the scripts executes but does not calls the CallBack function.

var url = ‘url here’; 
        var job_code = “js code here“; 
        wm_browser = cordova.InAppBrowser.open(url, '_blank', 'location=no, toolbar=no, EnableViewPortScale=yes');
        wm_browser.addEventListener("loadstop", function() { 
            timer_inapp = setInterval(function() {
                try { 
                    wm_browser.executeScript({
                        code : job_code
                    }, function(returnval) {
                        try {
                             //this not calls for some urls but the job_code executes successfully
                        } catch(e) {

                        }
                    });
                } catch(e) {

                }
            }, 5000);

        });

Anybody have a solution please?

0

There are 0 best solutions below