Two days ago I started to develop a new application, and I am just copied and pasted my other application, and then change it like how I want.
**The problem is that my old application worked perfectly with the share function, but the new one gives an error:
An error occurred. Please try again later.
I didn’t forget to change APP_ID in FB.init.
My share function:
<script type="text/javascript">
function fb_share()
{
var publish = {
method: 'stream.publish',
message: 'Apie tai, kuo gyvena kauniečiai :)',
attachment: {
name: 'Kas vyksta Kaune tiesioginės transliacijos',
caption: '',
description: (
'Kas vyksta Kaune vaizdas gyvai visiems kauniečiams!'
),
media: [
{
type: 'image',
href: 'http://www.facebook.com/Kaunas.gyvai?sk=app_292352984114290',
src: 'http://misterp.lt/apps/share/Bambuser_app_icon.jpg'
}
]
,href: 'http://www.facebook.com/Kaunas.gyvai?sk=app_292352984114290'
},
action_links: [
{ text: 'Tinklapis', href: 'http://www.facebook.com/Kaunas.gyvai?sk=app_292352984114290' }
],
user_message_prompt: 'Kas vyksta Kaune tiesioginės transliacijos'
};
FB.ui(publish, function(response) { console.log(response); });
}
</script>
I found an answer. The problem was that I included the “Facebook live stream” plugin in my application and at the same time used fbAsyncInit to resize the iframe.
I just deleted
js.src = "//connect.facebook.net/en_US/all.js#appId=292352984114290&xfbml=1";from the fb-live-stream plugin and the share function started to work.