Posting Messages from JavaScript
Posting messages from JavaScript is the easiest part. Here are the steps you have to follow:
- Include the following code before closing the body
block()
. -
Change the following details based on your app and the page you will be posting from:
- line 12: href should take the value of the page that you want to link to. Usually it will be the current page's URL.
- line 21: you need to enter the Application ID that Facebook generated for your app.
-
Call
publishOnFb()
. The only thing to do now is to call the JavaScript function to publish on Facebook. Create a link like the following: