Detecting Facebook API version at runtime? - javascript

What's a quick way to detect Facebook API version at runtime?
I'm not trying to do anything fancy with it, just to understand if the page I'm looking at happens to be using an ancient FB version somehow (debugging something related to FB init process). The specific API I'm referring to is the Like button.

The Facebook API isn't versioned - it's updated daily and with the biggest changes happening once a week.
There are also occasional updates to the supported SDKs, but they all call the same API, and unless the problem you're encountering is specific to the SDK itself, using a specific SDK shouldn't affect your app.
If it's the Javascript SDK - the SDK is loaded directly (at connect.facebook.net/en_US/all.js ) from Facebook, and is updated from Facebook's side daily

Related

Blocking websites on a web app using javascript

I'm currently developing a web app that allows users to add a list of websites that they want to block i.e. preventing them from accessing the website from their browser.
Ideally I want to be able to block websites on every browser but this is difficult, so I narrowed my research to just Chrome for now. I came across the chrome.webRequest api which seems promising but it specifically says its for chrome extensions and am unsure if it would work for my web app.
Can anyone point me in the right direction for blocking websites on a web app, ideally using javascript. Any help is much appreciated!!
EDIT:
1) I forgot to mention that I'm using firebase for my backend.
2) People have been saying that I can't block websites outside the web apps scope, if I instead used electron to make the web app a desktop application would it then be possible?
Firstly you have a database containing URL of blocked websites. URLs are modified using your web app. That's one part. Now your problem is how to make the browser work with your database.
The only possible way for you to share blocked URLs with the browser is via API. You must have API that can communicate outside your web app.
Now browsers such as chrome/firefox give users the power to make changes inside and outside the dom. For chrome, you have chrome extension where Google provides API so the users can manipulate actions outsides regular actions such as manipulating dom. An example I can give that is closely related to your subject matter, which is an action activated before/after a user enters URL on the search box and for that, we use the following API from https://developer.chrome.com/extensions/webRequest
And it's same for Firefox.

Using a Facebook Pixel, how does one trigger the activated app event using the JS SDK?

How do you get a FB pixel to fire when an app is installed or activated using the javascript SDK?
Based on the FB documentation, we are using:
FB.AppEvents.activateApp();
We have verified that the SDK is loaded, and the FB.AppEvents object and activateApp function exist.
We are able to log events using:
fbq('track','xxx');
When we use the helper tool provided by FB to test the pixel:
https://developers.facebook.com/tools/app-ads-helper/
it indicates that the app is setup, but that 'no installs were recorded in the past 7 days', even though we know that there have been installs, and they should have fired the call above.
Thanks.
As far as I've been able to tell, it's only possible to do this for iOS or Android apps using the native SDK or one of the cordova plugins (eg currently cordova-plugin-facebook4). If someone knows how to do this with the JS SDK, please post.

Access Chrome API in service worker

I'm trying to show the chrome rich notifications from my ServiceWorker but apparently I cannot access chrome api.
Is there a specific reason why this is not possible or is there a work around this?
Right now I am displaying notifications using ServiceWorker API by calling ServiceWorkerRegistration.showNotification() but this API can only do classic simple notifications.
That API belongs to Chrome Apps, it is not meant for website.
Indeed the documentation you linked is under the section Apps.

CRITICAL issue with iOS, CocoonJS and Facebook

I've just published in the Apple's Appstore a CocoonJS powered Javascript game that integrates some Facebook functions. After creating my app to Facebook, I spent weeks testing it in the CocoonJS Launcher, and I found the following:
In iOS, the user should grant permissions to apps that tries to access Facebook through the phone's Settings -> Facebook, where a list of apps appear.
I did so with the CocoonJS Launcher and then Facebook started working as expected. However, the final app (generated through the Cloud Compiler) has just been published in the store and, after trying to access Facebook from within the app, the app says that the user should grant permission from Facebook's settings (as I did with the Launcher), but it doesn't appear at the phone's Settings -> Facebook (that is, the list of apps that use Facebook and where it appeared the Launcher).
I've created my app in Facebook, retrieved its ID number, put it in the CocoonJS Cloud Compiler (both for Apple and Android) and, of course, called the "init" function inside the game with the corresponding Facebook app code... Even though it worked with the Launcher, it doesn't work with the app, and now my app is alive and no Facebook integration can be done (which is a real mess, because almost every game function uses it now)...
How could I solve it? What can be happening? Might it have something to do with the Cloud Compiler, or maybe it's related to the JS code?
Thanks in advance for your time and effort! :)
As states in help center, do some testing first with a custom launcher:
http://support.ludei.com/hc/en-us/articles/200767268-Custom-Launcher
The CocoonJS launcher you download from the store has the configuration string of Ludei:
http://support.ludei.com/hc/en-us/articles/200924496-Social
The problem may not have been in the submission, but in the development of the application.
In case you feel it's a bug, please fill a bug report with the following template in their help center.
The template guide:
http://support.ludei.com/hc/en-us/articles/203459717-How-to-report-a-CocoonJS-bug
The forum to post the issue (troubleshooting section):
http://support.ludei.com/hc/communities/public/topics/200011348-Problems-Troubleshooting

Does Apple reject Hybrid app if it loads resources including javascript from remote server?

For some purpose, I use web technology to develop my iOS app. In order to improve the UIWebView performance, I put the resources(including html/css/javascript) locally in app bundle to reduce the loading time.
I also create a thread to check resource update, and download the newer resources if needed. Next time the app can use the resources to render web view.
This solution works well.
But I worried that whether apple will reject my app because I download javascript from remote server. Is there any hybrid app that use similar solution and appear in app store?
You can download and execute javascript, provided that it's being executed by a UIWebView.
This is actually pretty common. If you need an example during a review (you won't), point to any alternate iOS web browser, like Chrome. They download and execute all kinds of web resources, but it's okay because they do it in a UIWebView and Apple trusts UIWebView.
That said, if you download resources that change your app's functionality in a way that would not be appropriate for an App Store product, you're likely to get it pulled and -- if the violation is egregious enough -- you may lose your developer account.
IBM Worklight platform is using similar approach.
You can read more on this thread (and it might give you some answers):
IBM Worklight - is Direct Update allowed by Apple's guidelines for the App Store?

Categories