Page 1 of 1

Run Javascript not Working

Posted: Sat May 09, 2015 11:27 pm
by Kimberley Griffith

I'm following the steps in the "Building Your First Mobile App" tutorial. I got to the step for Adding Native Features and copied the code onto the Run Javascript action for the 'Device Info' button. I saved the code but when I click the button, nothing happens.

Please assist. Link to the mobile app: http://appery.io/app/mobile-frame?src...


Run Javascript not Working

Posted: Sat May 09, 2015 11:28 pm
by Kimberley Griffith

Here's the javascript code pasted from the tutorial:

//Check if this app is installed as binary
if (document.URL.indexOf('a href="http://" rel="nofollow"http:///a') === -1 && document.URL.indexOf('a href="https://" rel="nofollow"https:///a') === -1) {
var msg = 'Model: ' + device.model + '\nCordova: ' + device.cordova + '\nPlatform: ' + device.platform;

Code: Select all

 navigator.notification.alert(
     msg,
     alertWindowClosed,
     'Appery.io App',
     'Close'
 );
 function alertWindowClosed() {

// do nothing for now
}
}
else
{
alert('Install app as binary to see the device details!');
}


Run Javascript not Working

Posted: Sat May 09, 2015 11:44 pm
by Illya Stepanov

Hi Kimberley -

In this part of tutorial you can test this code only on a device - as exported binary package and installed on device or using our Appery.io Mobile Tester app -- https://devcenter.appery.io/documenta...