It goes to top of page on using facebook stream.publish method - facebook

I am using following code for stream Publish, it is working but when this dialog box opens my page scrolls upward and dialog box is down some where so user need to scroll page to see dialog box so why is it hapenning ? how can I correct it?
var attachment = {'media':[{'type':'image','src':image,'href':'<?php echo CANVAS_URL; ?>'}]};
var action_links= [{ 'text':"Music Mood", 'href': '<?php echo CANVAS_URL; ?>' }];
FB.ui({'method':'stream.publish','message':message,
'attachment':attachment,
'action_links':action_links
});
I am using facebook iframe app.
Please reply,
thanks in advance.

use javascript:void(0); in href of your link

Related

Article open in modal window after a user click on facebook share link and come back to your site

I think I need your help here... On my site, I've done all the articles open in modal window by clicking on the link "read more" that exists in every article.
Also, each article has a button that shares this article on facebook.
But, when the user who will see my article on facebook, click this link to read the article, it come back to my page, but the article (logical) not open in modal window!!!
Is there any way, in the "return" of the user on my site, after having pressed the link of facebook, automatically open this article in modal window? Or, if the question above can't be done, is there any way by customizing the link I send to facebook, to set it in the "return" of the user to my site, after having pressed the facebook's link ofcourse, to show the article in intro view and not in full view?
Thank you very much for your time!
I'm using modal windows in my website and I utilize the following HTML code to open an article in a popup:
<a class="modal" rel="{handler: 'iframe', size: {x: 680, y: 370}}" href="yourarticleid=759&tmpl=component&task=preview">Open a link in modal</a>
The method above uses the native function for creating the modal window and calls the article you need to display. However, since Facebook formats all posted links I don't think you'll be able to include the crucial piece of code (below) that triggers the modal window.
class="modal" rel="{handler: 'iframe', size: {x: 680, y: 370}}"
Here is a kind of solution, an idea in other words, that make your articles open in modal window, after a user click on facebook share link and then come back to your site.
In my case I did this...
To open modal windows in my site, I am using the extension modalizer from nonumber.nl. This extension adds something like that &ml=1 at the end of article's url. The link that comes from facebook don't contain this &ml=1 at the end. So...
1. First of all, in to my article's content, I should include modal's behavior.
2. Then, I should make my code check if the url has this &ml=1 at the end or not.
3. After, I should decide what my code will do in those two cases. So, I want to do nothing if &ml=1 already exists and I want to open facebook's url in modal window if &ml=1 doesn't exist. I also want everytime that I close my modal window to load index.php, else user will see my article on frontend view.
Here is the code for all this:
<?php JHTML::_('behavior.modal');
$url= 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
if (strstr($url, "&ml=1")){/* Do nothing */}
else {?> <a class="modal" id="modalWindowLink" href="<?php echo $url ?>"></a>
<script>
window.addEvent('domready', function(){
window.addEvent('load', function(){ SqueezeBox.fromElement($('modalWindowLink')); });
});
SqueezeBox.addEvent('onClose', function(){ window.location = 'index.php'; });
</script>
}
<?php } ?>
If you have any better idea, or if you see something that could work better in other way, please let me know!!!

How to customize a Facebook Send Button?

I'm trying to customize the appearance of a facebook 'Send' button.
I generate the button using the code provided in the docs, however I don't have a clue of how I could modify the button's image or text ?
Could anyone give me an example? I guess javascript is my only option here?
My code looks like this right now:
<fb:send href="http://www.mywebsite.com/something"></fb:send>
This generates a button that looks like this:
Thanks!
You cannot customise the <fb:send /> button. However, you can achieve the same functionality using FB.ui (http://developers.facebook.com/docs/reference/javascript/FB.ui/). Use the send method, eg.
FB.ui({
method: 'send',
name: 'People Argue Just to Win',
link: 'http://www.nytimes.com/2011/06/15/arts/people-argue-just-to-win-scholars-assert.html',
});
You can always create your own link and style it however you wish, then add the link from this list of all social sharing button links list - this works for sharing to all sorts of social sites.
For Facebook's share link, replace [URL] and [TITLE] with your data using urlencode()in the following code in your link's href:
http://www.facebook.com/share.php?u=[URL]&title=[TITLE]
You're pretty much SOL when it comes to customizing these Facebook buttons. They have intentionally designed their buttons so that you can't change or customize them beyond the limited scope provided by Facebook.
Facebook's send button is in an iframe. If you wait for the iframe to load, you can select its contents with $('iframe').contents(). So replacing the text would look like
$(function(){
$('.fb_iframe_widget iframe').on('load', function(){
$(this).contents().find('.pluginButtonLabel').text('Custom Text');
});
});

fb like + send button

I have the like and send button on the right side of my website.
When I click on either buttons, it displays a box but it extends towards the right thus giving me horizontal scroll bars.
Is there a way to have the box extend towards the left?
Many thanks guys.
I have looked at this before and it is a pain in the £%^^&! Unfortunately because the elements are in an iframe you can't use your own stylesheets to overwite the styles and move the popup left. Instead what I have done in the past is mimic the send button to the left of the like button and use the FB.UI method to show a popup centred window like so:
<script>
$(function () {
$('#sendbutton').click(function (e) {
e.preventDefault();
FB.ui({
method: 'send',
name: 'Blah blah blah',
description: 'Description',
link: 'http://www.example.com',
image: 'http://www.example.com/content/images/image.png'
});
return false;
});
});
</script>
<a id="sendbutton" href=""><img src="#(Url.Content("~/Content/Images/send.png"))" /></a>
don't forget you will need to initialise the Facebook javascript API first:
http://developers.facebook.com/docs/reference/javascript/
Is there a way to just simply 'like' without opening the box?
No. You can try to hide the box by enclosing the iframe with a div and setting the div's height to something suitable and its overflow property to hidden, but that's about it. You might want to file a feature request with Facebook.

How to make facebook app authorization popup show in overlay on facebook page

there is exactly what I saw.
http://www.facebook.com/cocacola?sk=app_192765884109675
I don't know how they did it. I tried fb.ui change the display options. It always just give me a pop up window. so how to do the overlay?
Thanks in advance!
Finally answer is:
All you need ask authorization:
FB.ui({ method: "permissions.request" });
from:
http://www.facebook.com/mypage?sk=app_1234567890
voila: you have popup in iframe.
However from:
http://apps.facebook.com/myapp
you will have popup without iframe

How to display the facebook request dialog inside our app page?

I'm using the facebook request dialog from http://developers.facebook.com/docs/reference/dialogs/requests/ and its working fine.
Now it displays a popup dialog window with the friends of my facebook account.
Now i tried to display the dialog inside my application page itself and i tried to change the display property to 'page' and also 'iframe' and it doesn't seems to be working..
I'm sure that i've initiated the fb using fb:init and it was working fine when i remove the 'display' property.
How can i do that?
Here's my code..
function newInvite(){
var receiverUserIds = FB.ui({
method : 'apprequests',
display: 'page',
//filters: ['app_non_users'],
message: 'Come on man checkout my new application',
},
function(receiverUserIds) {
//my own callback fun
}
);
}
I've a button for invoking this request and i'm calling this function using jquery as
$('#invite_frd').click(function(){
newInvite();
});
just find the below part in url
display=wap
and change it to
display=touch