Using Facebook Native in browser


#1

I have implemented the native Facebook plugin in my app (works well) but now I’m trying to run the app as a web page. Sort of as expected, when running “ionic serve”, I get an error when attempting to login with facebook:

Native: tried calling Facebook.login, but Cordova is not available.

So I did a few tests and it turns out that if I add the platform “browser” and then run the following command:

ionic cordova run browser

I no longer get the error and I get a facebook token so this can actually run in the browser.

Now I would love to be able to run some tests and debug my app with livereload using “ionic serve”. I’m not sure to understand why the plugin works when using “ionic cordova run browser” but not “ionic serve” since they both end up running in the browser.

Any ideas?

@ionic/cli-utils  : 1.19.0
ionic (Ionic CLI) : 3.19.0
cordova (Cordova CLI) : 7.1.0
@ionic/app-scripts : 3.1.4
Cordova Platforms  : android 6.3.0 browser 5.0.1
Ionic Framework    : ionic-angular 3.9.2
Android SDK Tools : 26.0.2
Node              : v6.10.3
npm               : 3.10.8
OS                : Windows 10