can I have a question about how to redirect the page after user invite their friends?
i have a code like this: (in javascript)
function inviteFriends(){
if(isBusy) return false;
isBusy = true;
$(".musicPlayer").addClass("invisible");
var fbsc = '<fb:request-form
action="apps.facebook.com/yourapp?pageid=thanks"
target="_self"
method="post"
nvite="true"
type="Contest"
content="Come and Join this contest!"> <fb:multi-friend-selector
target="_self"
showborder="false"
max="30"
import_external_friends="false"
email_invite="false"
cols="5"
actiontext="Invite your friends!" /></fb:request-form>';
var uiSize = FB.UIServer.Methods["fbml.dialog"].size;
FB.UIServer.Methods["fbml.dialog"].size = {width:625};
FB.ui({
method:'fbml.dialog',
display: 'dialog',
fbml: (fbsc),
width: '625px'
},function(response) {
$(".musicPlayer").removeClass("invisible");
window.location = "?pageid=thanks";
isBusy = false;
});
}
that script will call fbml window with facebook's invite friends dialog inside facebook dialog window.
what i want is:
when you close the window (press x at top right corner) it'll redirect to: ?pageid=thanks (this is works with the script above)
when user press the skip button on invite friends dialog it'll redirect to: ?pageid=thanks (this is not working - It'll redirect to ?pageid=thanks but inside the fbml window)
when user have done inviting their friends, it'll also redirect to: ?pageid=thanks (this is also not working - it'll redirect to ?pageid=thanks but in new window -.-!)
am I miss something on my script above, or I'm using the wrong way?
I'd like to achieve this for at least in IE and Firefox
is anyone have done with this before? I really need your suggestion,
EDIT:
if i put:
<fb:request-form target="_top" blah...> <fb:multi-friend-selector target="_self" blah...>
The skip button is working :) but still, after you're done inviting your friends it'll redirect to a new window
If I Put:
<fb:request-form target="_top" blah...> <fb:multi-friend-selector target="_parent" blah...>
This is work if you invite your friends, but not if you press the skip button -.-!
I reckon this is because of facebook open-up another dialog window when you click invite your friends (to preview before you click send)
so the structure level was different between skip button and send button (i hope you got what I'm write)
Thank you in advance
AnD
This is The answer :)
var fbsc = '<fb:request-form action="url here" target="_top" method="post" invite="true" type="Contest" content="blah...">
<fb:multi-friend-selector target="_top" showborder="false" max="30" import_external_friends="false" email_invite="false" cols="5" actiontext="Join NOW to WIN!" /></fb:request-form>';
Note: target="_top"
Try changing target="_self" to target="_parent" i'm not sure that is exactly what you need but the target is the relevant parameter here.
Related
Hello I am designing a landing page for my company.. We have ads on FB. we have button on fb when click on that button our landing page opens.
We have 2 option on page one with yes button which will open form and no button should close browser and re direct to fb page.. plz help how can i re-direct it to fb.
<button class="btn-yes">Yes</button>
This is my button which should be re-directed to fb.. plz help if possible with javascript, jquery.
thanks
You can use this jQuery code for your button.
$('.btn-yes').click(function() {
window.location.href = 'your fb link';
return false;
});
Add link to assign window.location.href.
You can use tag
<button class="btn-yes">Yes</button>
If you want to open it in new page
<a target="_blank" href="{your fb link}"><button class="btn-yes">Yes</button></a>
I explain better: i'm growing my community on facebook asking friends to invite other friends with this link
https://m.facebook.com/send_page_invite/?pageid=MYPAGEID
I'm wondering if could i insert this url inside an iframe and auto-execute the script i use for invite all friends
*--- javascript:var inputs = document.getElementsByClassName('CLASS-NAMES'); for(var i=0;i
on tab opening.
I hope my English is sufficiently understandable, and thank you all
The only thing that comes to mind is to track tabs, if user clicked a link with blank on it, then add some value to a session, or to href parameter, and then manualy check if he came from a new tab or something.
If you want FB invite friend in an iFrame you have
to initiate the facebook Connect API first and for this we need XFBML initialization in the bottom of the page.
You should use fb:serverfbml tag to get fb:friend-selector working.
assuming this is your iframe body content
<fb:serverfbml style="width: 650px;">
<script type="text/fbml">
<fb:fbml>
<fb:request-form
action="http://your-site.com/invite/sent"
method="POST"
invite="true"
type="My App"
content="download my application FREE NOW"
<fb:req-choice url='http://your-
facebook-canvas-url'
label='<?php echo
htmlspecialchars("Accept button text",ENT_QUOTES);
?>'
/>
" >
<fb:multi-friend-selector
showborder="false"
actiontext="Invite your friends."
exclude_ids="optional"
rows="3"
/>
</fb:request-form>
</fb:fbml>
</script>
</fb:serverfbml>
//this script up will display the invite friend on the //iFrame tag .
//to connect use FB.connect code
<script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript">
</script>
<script type="text/javascript">
FB_RequireFeatures(
["CanvasUtil"],
function(){
FB.XdComm.Server.init('/xd_receiver.html');
FB.CanvasClient.startTimerToSizeToContent();
}
);
</script>
<script type="text/javascript">
FB_RequireFeatures(["XFBML"], function(){
FB.Facebook.init("write your api key authintication
here", "/xd_receiver.html"); });
</script>
I've been working on a web page where they want the person to sign up for something. As a result, they have an alert window on the page, the person hits the "sign up" button, and the alert window loads with a form.
No big deal about that. However, on the browser page underneath, and on the form on the second stage of signup, there are links to standard disclaimer pages. They want these to be pop up windows when the user clicks on them.
When I was testing it out, in generic form (no user signed in - the page and disclaimers are declared "public" so you don't need to be logged in to see them), it worked fine.
However, if the user is logged in, when you hit the disclaimer links, it instead loads that same "signup" page - the parent page!
I'll post my coding, but what I'm looking for is twofold - is there an easy way to keep other content from loading in that popup?
If not, I'm guessing that it has something to do with that omnipresent signup popup/alert, and as this other content gets pulled in, there's coding that tells it to load any subsequent popups with that same page. Is there some kind of language I should be looking for? It's all very modular, with a lot of includes, to tracking things down can be tricky. Less so if someone has some suggestions, I'd guess.
<script language="javascript" type="text/javascript">
// Popup window code
var popupWindow = null;
function popitup(url2,winName,w,h,t,l,scroll){
settings =
'height='+h+',width='+w+',top='+t+',left='+l+',scrollbars='+scroll+',resizable'
popupWindow = window.open(url2,winName,settings)
}
</script>`
<p>© <%=Year(now)%> <%=usr_Company%> All Rights Reserved.
<a style="color: #898787;" href="info_privacy1.asp" onclick="popitup(this.href,'disclose','700','780','100','200','yes');return false">Privacy Policy</a> | <a style="color: #898787;" href="info_terms1.asp" onclick="popitup(this.href,'disclose','700','780','100','200','yes');return false">Terms of Service</a> <br /><br />
<%=brand_name%> legal disclaimer blah blah blah blah blah.<br /><br />
</p>
</div>
</div>
</body>
</html>
`
You have to let the JS know that the user is signed in. Few ways to do this - AJAX, but more so simply on page load -IDK what you are using - php or whatever, but what it should do is this:
if user is signed in, print out a globav variable to javascript "userSignedIn = 1"
then when the user clicks a link, js checks if userSignedIn is set to 1, and if it is, it will not display the signup window, but continue to the next one, if userSignedin is not set (or is not 1), the signup form will be displayed...
I'm working with the facebook SDK and it works through popups due to security issues now.
So I've got a button that deals with facebook [FacebookButton] which is hidden, and a button to test for popup blocker [PopupTester].
My code is like this,
when [PopupTester] is clicked, if a popup works: close it, hide this button, and show [FacebookButton].
or
when [PopupTester] is clicked, if popup fails, show dialogue to urge to change popup settings, keep [FacebookButton] hidden, change this button value to [Try Again].
function testPopupBlocker() {
var windowName = 'userConsole';
var popUp = window.open('http://www.whirlocal.com', windowName, 'width=200, height=200, left=24, top=24, scrollbars, resizable');
if (popUp == null || typeof(popUp)=='undefined') {
var weGood = "nope";
alert('Please disable your pop-up blocker and click the link to test again.');
}
else {
var weGood = "yup";
popUp.close();
}
}
This works great, except for the fact that this button always creates a popup, but the Facebook one is still being blocked!
Is there another method besides "window.open" to create a popup? One that is more likely to be blocked?
EDIT:
Here's my button codes
<input type="button" class="genButton testPopupButton" name="Test Popup Blocker" title="Test Popup Blocker" value="Test Popup Blocker" onclick="testPopupBlocker()" style="cursor:pointer;" />
<input type="button" class="genButton needsPopups facebookButton" name="AdvocateOnFacebook" title="Recommend <?php echo genesis_get_option('organization','child-settings');?> on Facebook" value="Recommend us on Facebook!" onclick="advocateToFriends()" style="cursor:pointer; display:none;" />
You need to legitimize the popup. It needs to be initiated by the user, and not arbitrary popup code, or else a popup blocker will stop it. Once you have a handle on the popup, then you may modify it however you like.
Try this html code out:
<a href="#" onclick="javascript:window.open('http://myurl.com/blank_page.html','userConsole','width=800,height=600,directories=no,location=no,menubar=no,status=no,toolbar=no,scrollbars=auto,resizeable=yes');">
<div class="some_div_class"><b>Click Me</b></div>
</a>
Then run your testPopupBlocker() function and see if it works a little better.
How do I make one of those hyperlinks where when you click it, it will display a popup asking "are you sure?"
<INPUT TYPE="Button" NAME="confirm" VALUE="???" onClick="message()">
I already have a message() function working. I just need to know what the input type for a hyperlink would be.
<a href="http://somewhere_else" onclick="return confirm()">
When the user clicks the link, the confirm function will be called. If the confirm function returns false, the link traversal is cancelled, if true is returned, the link is traversed.
try to click, I dare you
with the function
function confirmAction(){
var confirmed = confirm("Are you sure? This will remove this entry forever.");
return confirmed;
}
(you can also return the confirm right away, I separated it for the sake of readability)
Tested in FF, Chrome and IE
As Nahom said, except I would put the javascript:message() call directly in the href part (no need for onclik then).
Note: leaving the JavaScript call in the onClick has a benefit: in the href attribute, you can put a URL to go to if the user doesn't have JavaScript enabled. That way, if they do have JS, your code gets run. If they don't, they go somewhere where they are instructed to enable it (perhaps).
Now, your message routine must not only ask the question, but also use the answer: if positive, it must call submit() on the form to post the form. You can pass this in the call to ease the fetching of the form.
Personally, I would go for a button (input tag as you show) instead of a simple link to do the process: it would use a more familiar paradigm for the users.
[EDIT] Since I prefer to verify answers I give, I wrote a simple test:
<script type="text/javascript" language="JavaScript">
function AskAndSubmit(t)
{
var answer = confirm("Are you sure you want to do this?");
if (answer)
{
t.form.submit();
}
}
</script>
<form action="Tests/Test.html" method="GET" name="subscriberAddForm">
<input type="hidden" name="locationId" value="2721"/>
<input type="text" name="text" value="3.1415926535897732384"/>
<input type="button" name="Confirm" value="Submit this form" onclick="AskAndSubmit(this)"/>
</form>
Yes, the submit just reload the page here... Tested only in FF3.
[EDIT] Followed suggestion in the comments... :-)
???
This answer would be OK only when the click need NOT navigate the user to another page.