Page 1 of 1

window.plugins is undefined error

Posted: Mon May 27, 2013 7:00 am
by Dimitris Monastiriotis

Hi I try to test the facebook api example however when pressing the button - where I have attached the code below in the click event - I get an error in firefox console where I test it that window.plugins is undefined is there some way I can include it so that it works ??? (In the App settings the phonegap is set.)

var redirectUrl = 'this is the redirect url';

var url = 'Here goes the facebook details url';

var cb = null;

if(window.plugins) {
cb = window.plugins.childBrowser;
alert("window plugin");
}
if (cb != null) {
/* Wen native childBrowser plugin must be used to navigate to facebook. /
cb.onLocationChange = function (url) {
if(url.indexOf(redirectUrl) === 0) {
/ if user successfully logged in /
cb.close();
var vars = parseUrlVars(url);
localStorage.setItem('code', vars.code); / store secret code /
Appery.navigateTo('result', {reverse: false}); / Navigate to page 'result' */
console.log("Code taken");
console.log(localStorage.getItem('code'));
}
};

Code: Select all

cb.showWebPage(url); 

} ;


window.plugins is undefined error

Posted: Mon May 27, 2013 7:19 am
by Kateryna Grynko

Hi Dimitris,

The variable window.plugins has a value = undefined on browser only. If you build app, install and run on device then Cordova plug-ins will be saved in this variable.


window.plugins is undefined error

Posted: Mon May 27, 2013 7:32 am
by Dimitris Monastiriotis

thanks for your reply, but I need to test on browser first, how can I include the plug-ins needed so that it can also run successfully in the browser as well???


window.plugins is undefined error

Posted: Mon May 27, 2013 7:43 am
by Kateryna Grynko

Try Google Chrome extension:
http://www.tricedesigns.com/2012/07/3...