Cordova Application Error - The connection to the server was unsuccessful

On older versions of Android, loading remote scripts can cause a timeout, which leads to this error. If you defer loading for a second or two, it generally fixes the issue.
/* resolve: Application Error - The connection to the server was unsuccessful. 
(file:///android_asset/www/index.html)  */
setTimeout(function() {
	(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.async = true; js.src = 'http://connect.facebook.net/en_US/all.js#xfbml=1&oauth=1&status=1&cookie=1&appId=' + app.facebook_app_id; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));
	(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.async = true; js.src = 'http://platform.twitter.com/widgets.js'; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));
}, 2000);
Snippet Viewed 5191 times.

Share your Cordova code snippets:

  • Get some recognition & a link back to your site.
  • Create your own code library.
  • Help your fellow developers, as they have helped you.

 

Submit | Browse

Most Recent cordova snippets

Most Viewed