cordova - How can I call the Blackberry API for a hosted webapp WebWorks? -
i using webworks make hosted web app, i.e. app open website url. want include native blackberry api functions (e.g. toast) app.
everything working fine. include url (for example, http://www.example.com/index) in "main url" field. , on site, have added line
so can load cordova.js , use blackberry functions.
but if change "main url" https https://www.example.com/index, cordova.js can't loaded anymore. on web inspector console, says
[blocked] page @ https://www.example.com ran insecure content local:///cordova.js.
i have tried add local:///
whitelist, , turn "enable web security" off, no avail.
please advice can do. thank much!
this first post of mine (also new bb dev) suggest if not correct , accept sincere appologies. giving step step hope don't offended others new bb dev see helpful them.
step 0: start "blackberry 10 simulator".
step 1: start "blackberry webworks 2.2.0.15"
step 2: opens browser localhost:3123/
step 3: create sample project giving create project project id project name project path
step 4: create project index.html file
step 5: click on plugins tab on browser localhost:3123 , add "com.blackberry.invoke"
step 6: replace body section of code of index.html code mentioned below:-
<body> <div class="app"> <a onclick="openweblink()"> click me test opening https </a> <div id="deviceready" class="blink"> <p class="event listening"> </p> <p class="event received"> </p> </div> </div> <script type="text/javascript" src="cordova.js"></script> <script type="text/javascript" src="js/index.js"></script> <script type="text/javascript"> app.initialize(); function oninvokesuccess() { console.log("invocation successful!"); location.href = "https://www.hsbc.co.uk/1/2/"; } function oninvokeerror(error) { console.log("invocation error!"); } function openweblink() { blackberry.invoke.invoke({ uri: "https://www.hsbc.co.uk/1/2/" }, oninvokesuccess, oninvokeerror); } </script> </body>
step 7: click on build tab on browser
choose build mode : debug mode , target type : simulator
step 8: click on build , install. once ready opens app on simulator , prompts ok button click on it.
step 9: again click on "click me test opening https" opens browser secure url
step 10: if works might give hint on how want proceed.
Comments
Post a Comment