Disable WebView Application Being Pull Up and Down

I’ve created a hybrid app using Cordova, and notice I’m able to pull the header down and footer up, which lead to weird behaviour when using the app (at least I feel so).

Normal View

normal view

Pull Up

pull up

pull down

pull down

Adding single line of configuration in config.xml solve the issue. (pheeew… spend couple of hours to research this)

<preference name="DisallowOverscroll" value="true"/>
Reference: http://cordova.apache.org/docs/en/6.x/config_ref/index.html
 

Beware when import cordova.js

If you would like to trigger the “deviceready” event fires when Cordova is fully loaded for some plugin usage,

document.addEventListener("deviceready", callbackFunction, false);

you need to include cordova.js in your application.

<script type="text/javascript" src="cordova.js"></script>

OK, you are done.

If you facing some unknown error in console as below even you have whitelist plugin added, cordova.js included,

Uncaught Error: Module cordova-plugin-whitelist.whitelist does not exist.
cordova.js:891 deviceready has not fired after 5 seconds.
cordova.js:884 Channel not fired: onPluginsReady
cordova.js:884 Channel not fired: onCordovaReady

then probably you include cordova.js wrongly as what I did (get from /platforms/android/assets/www/cordova.js)

<script src="asset/js/cordova.js"></script>

NOTE: You does not need to copy cordova.js from anywhere, just include as above mention will do, Cordova will figure out for u 🙂

 

Netbeans cannot find cordova or git on your PATH but your have already set it ?

You have already set the cordova and git in your PATH, but still facing above mention problem.
Try to rename .bash_profile to something else and restart netbeans.
If that helps, means you have some “dirty” code in your .bash_profile which you may remove it.
(as in my case, I have an echo statement which prevent me to create cordova application)

If it doesn’t, continue google 🙂

p/s: To confirm you have cordova and git in your PATH, there must be version number return when you issue command below in terminal (line by line):
cordova –version
git –version