Welcome Guest, Not a member yet? Register   Sign In
Custom post on facebook
#1

(This post was last modified: 02-12-2016, 05:29 AM by Bhavesh.)

Hi Friends,

I have used java script for custom share post on Facebook.

Below is my code

PHP Code:
<script>
var 
FB;
window.fbAsyncInit = function() {
FB.init({
appId 'xxxxxxx',
xfbml true,
version 'v2.4'
});
};
(function(
dsid){
var 
jsfjs d.getElementsByTagName(s)[0];
if (
d.getElementById(id)) {return;}
js d.createElement(s); js.id id;
js.src "//connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(jsfjs);
}(
document'script''facebook-jssdk'));
function 
ShareOnFB()
{
FB.ui({
method'share',
href'http://www.[MYSITE].com',
caption'QeRetail - www.[MYSITE].com',
description'Wow...!!! I have got Free test',
title'We maintain & Market your online store',
picture'[SITE_URL]/images/banner.jpg',
}, function(
response){});
}
</
script>
<
a href="#" onclick="ShareOnFB();">Share on FB</a>
</
body>
</
html



I want to add multiple links in banner, caption etc .
Is it possible?
Please give me suggestion.
Thanks in advance
Reply
#2

Since you're just using an onclick attribute in your link to call a JavaScript function, you can do this in as many places as you'd like. In most cases, I would add a class or some set ID values to the links, then update the links or add an event handler to the page's body element to set the function as the event handler for those links. This is basic JavaScript and not really related to CodeIgniter.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB