Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Phonegap / Cordova 2.7 Mutes Console.log

I recently upgraded from Cordova 2.5 to Cordova 2.7. After upgrading, I noticed that none of my javascript console.logs were firing from the application when viewing in Chrome. They appear just fine using 2.5.

I initially thought this issue may be related to the XHR function added in the new version (see this thread - Why does Cordova 2.7.0 JS seemingly no longer work on remote pages?)

But after commenting out that block of code, I'm still having issues in that my logs aren't appearing.

Is anyone else having this problem? Any thoughts on how to remedy the situation (other than using an older version of Cordova)?

Thanks in advance.

like image 569
jjsquared Avatar asked Jan 26 '26 13:01

jjsquared


1 Answers

I had the same problem, then I used this workaround to don't load cordova.js when I'm debugging in chrome.

  <script>
    if (navigator.userAgent.toLowerCase().match('chrome'))
    {
        console.log("Browser", "chrome");
    }else{
          var fileref=document.createElement('script');
          fileref.setAttribute("type","text/javascript");
          fileref.setAttribute("src", "cordova-2.7.0.js");
          document.getElementsByTagName("head")[0].appendChild(fileref);
          console.log("Browser", navigator.userAgent.toLowerCase());

    }
    </script>
like image 74
Cristian Avatar answered Jan 28 '26 22:01

Cristian