1

Good day! I am developing a simple mobile app using jQuery Mobile with InAppBrowser plugin on IntelXDK. The purpose of the InAppBrowser is to let users view external web pages within the app. On IntelXDK emulator, the browser closes when I click on "Return to App" button and then it returns to the app. However, I encountered a problem on an Android build when I clicked on the "Done" button I received the message:

Webpage not available

The webpage at file:///android_asset/www/[object%20Event] might be temporarily down...

I have used the following so users can click and view external web pages:

  1. Opening links in external device browser with Cordova/jQuery-mobile

I have modified the above to be used on my app:

$(document).on('click', '.link', function (e) {        
       var elem = $(this);           
       var url = elem.attr('href');
       if (url.indexOf('http://') !== -1) {
           e.preventDefault();
           document.addEventListener("deviceready", onDeviceReady, false);       
           onDeviceReady(url);
           //return false;
       }
    });

function onDeviceReady(url) {
    var ref = window.open(url, '_blank', 'location=yes');  
}     

Thank you for your time and help. I really appreciate it.

Community
  • 1
  • 1
castle
  • 216
  • 3
  • 9
  • Have you checked in the debugger to see what value is in `url`? When you say "hit the `Done` button", what do you mean exactly? Do you mean the `Return to App` button in the in-app web browser? Or the Android back button? Or some button in your App? – OldGeeksGuide Aug 27 '14 at 04:30
  • Hi! The reason why it was displaying an error message because the test file was calling another onDeviceReady function. Problem solved! :) – castle Aug 29 '14 at 22:17
  • Glad to hear it. If you don't mind, it would be good to provide your own description of the fix as an answer (with appropriate level of detail) and mark it as accepted. Avoids loose ends and generally improves stackoverflow. – OldGeeksGuide Sep 02 '14 at 23:19

1 Answers1

0

The reason why it was displaying an error message because the test file was calling another onDeviceReady function. Problem solved!

castle
  • 216
  • 3
  • 9