Dimitris Monastiriotis
Posts: 0
Joined: Sat May 25, 2013 11:22 am

window.plugins is undefined error

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); 

} ;

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

window.plugins is undefined error

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.

Dimitris Monastiriotis
Posts: 0
Joined: Sat May 25, 2013 11:22 am

window.plugins is undefined error

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???

Return to “Issues”