facebook PermissionDialog - facebook

<script
src="http://static.ak.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php"
type="text/javascript"></script>
<script type="text/javascript">
FB.init('cef61789d5df166ac00c9fe13007c110', "xd_receiver.htm");
FB.Connect.showPermissionDialog("offline_access");
</script>
After a user login i am using the above code to get the Dialog box.
Why itsnt showing permission dialog??

I had this problem. Wrap the call to FB.Connect inside an "ensure init" like so:
FB.ensureInit(function() { FB.Connect.showPermissionDialog("offline_access"); });
That cleared things up for me.

Related

Foundation Reveal Modal will not close

While trying to create a modal using Foundation Reveal, I found that I couldn't close it. Not by using the reveal-modal-close class, not by javascript, nothing was working.
I tried to put this example from the documentation into the page:
<div id="myModal" class="reveal-modal" data-reveal>
<h2>Awesome. I have it.</h2>
<p class="lead">Your couch. It is mine.</p>
<p>I'm a cool paragraph that lives inside of an even cooler modal. Wins!</p>
<a class="close-reveal-modal">×</a>
</div>
When the page loads, it's open, but I can't get it to close. Also, not sure why it loads open.
At the bottom of my <body>, I have this:
<script src="//ajax.aspnetcdn.com/ajax/modernizr/modernizr-2.6.2.js"></script>
<script src="//ajax.aspnetcdn.com/ajax/jQuery/jquery-1.10.2.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/foundation/5.3.1/js/foundation.min.js"> </script>
<script src="//cdnjs.cloudflare.com/ajax/libs/foundation/5.3.1/js/foundation/foundation.reveal.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/flexslider/2.2.2/jquery.flexslider-min.js"></script>
<script src="//code.jquery.com/ui/1.10.3/jquery-ui.min.js"></script>
<script src="js/smooth-scroll.js"></script>
<script type="text/js" src="js/modal.js"></script>
<script>
$(document).foundation();
</script>
you don't need to load both foundation.min and foundation.reveal, just load min unless you need only reveal. Also you don't need modal.js - might be a conflict there.
See documentation here and follow it, should work once you fix the above issues: http://foundation.zurb.com/docs/components/reveal.html

mobile back button not working in phonegap project?

When i click on a link this will redirect me to another page in my app.
But after that when i am clicking on the mobile's back button it is not redirect me to previous page.
Ca anyone have answer of this question.
Actually device's back button click is also an event in PhoneGap. You can define the beckbutton event as a function.
<html>
<head>
<title>Sample</title>
<script type="text/javascript" charset="utf-8" src="phonegap-1.0.0.js"></script>
<script type="text/javascript" charset="utf-8">
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
document.addEventListener("backbutton", backButtonClick, false);
}
function backButtonClick() {
//Do something here on backbutton click or go back to last page.
window.history.back()
}
</script>
</head>
<body>
</body>
</html>
Its a sample, now tweak your page as you wanted.
Always write the backbutton event on deviceready!

TypeError: $("#city").autocomplete is not a function

This is my php page coding:
<script type="text/javascript" src="js/addclasskillclass.js"></script>
<script type="text/javascript" src="js/attachevent.js"></script>
<script type="text/javascript" src="js/addcss.js"></script>
<script type="text/javascript" src="js/tabtastic.js"></script>
<script type="text/javascript" src="js/ajax.js"></script>
<script type="text/javascript" src="js/ajax-dynamic-list1.js"></script>
<script type="text/javascript" src="js/backtotop.js"></script>
<link type="text/css" rel="stylesheet" href="calendar/dhtmlgoodies_calendar.css?random=20051112" media="screen"></LINK>
<script language="javascript" type="text/javascript" src="calendar/dhtmlgoodies_calendar.js?random=20060118"></script>
<script type="text/javascript" src="js/jquery.autocomplete.js"></script>
<script>
$(function() {
$(window).scroll(function() {
if($(this).scrollTop() != 0) {
$('#toTop').fadeIn();
} else {
$('#toTop').fadeOut();
}
});
$('#toTop').click(function() {
$('body,html').animate({scrollTop:0},600);
});
});
</script>
<script>
$(document).ready(function(){
$("#city").autocomplete("autocityuser.php", {
selectFirst: true
});
});
</script>
<form method="get" name="frm1" id="frm1" action="#">
<input type="text" id="city" name="city" value="" style="width:160px;" size="30" />
</form>
When i load this page the FF shows me this error:
TypeError: $("#city").autocomplete is not a function
I've applied the same code for autocomplete on another page (but with less js imports) and it is working fine.
but it is showing me error on this page, may be beacause some js is conflicting.
Can anyone help me to solve this error???
P.S. I forgot mention that i have 2 forms on this page both with different ids and names
P.S. I still don't know what the problem was , but fortunately
The problem is solved,
i just put below code at the end of the page and everything works perfect.
<script>
$(document).ready(function(){
$("#city").autocomplete("autocityuser.php", {
selectFirst: true
});
});
</script>
Are any other libs using $ and overwriting jQuery's usage of it? Maybe, try jQuery("#city").autocomplete
You're using part of the jQuery UI (autocomplete) but it doesn't look like you have the jQuery libraries in place.
Try including the following scripts:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
<script src="http://code.jquery.com/ui/1.8.22/jquery-ui.min.js" type="text/javascript"></script></script>
EDIT
I think your basic approach is wrong.
You want to call the PHP to get your autocomplete options using AJAX and stick the echoed value into a variable availableTags. Then you want to set up your autocomplete.
Something like this (not tested):
var availableTags;
$.get("autocityuser.php", function(data){
availableTags = data; // You need to format the data either here or in your PHP
});
$("#city").autocomplete({source: availableTags});​
I had this same problem recently recently. I found that two different version of jquery lib file was included from two different place.
Look for extra inclusion using firebug as js library could have been included from other included files.

sharethis is stopping page to load in IE 8

I have a sharethis link on my site having the below mentioned code ...
<script type="text/javascript">
addthis_url = location.href;
addthis_title = document.title;
</script>
<script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12"></script>
But this is not working as the page stops loading after the addthis_widget.php like . I even changed the code to newer version i.e.
<!-- AddThis Button BEGIN --> <a class="addthis_button"></a> <script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js?pub=ogmios"></script> <!-- AddThis Button END -->
But this code is too stopping the page load in IE8.
Any help will be appreciated.
Thanks
Jawed
Jawed,
Looks like you are using AddThis not ShareThis..
Why don't you try using ShareThis instead http://sharethis.com/publishers/get-sharing-tools
-Manu

Resizable Iframe for facebook iframe applications

I have an iframe application build up on php.
I have set iframe size as resizable.
There is a problem the display is not proper if the content is too large.
I have applied the code available on http://wiki.developers.facebook.com/index.php/Resizable_IFrame
My xd_receiver.htm file is inside my templates folder where my php files are residing.
The code which I am using is:
<div id="FB_HiddenIFrameContainer" style="display:none; position:absolute; left:-100px; top:-100px; width:0px; height: 0px;"></div>
<script src="http://static.ak.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.htm>);
FB.CanvasClient.startTimerToSizeToContent();
}
);
</script>
Please guide on how to make the display correct.
even though In am not sure about this, but Large content could be the the real issue,
try to move this part to the end of your page
FB_RequireFeatures(["CanvasUtil"],
function(){
FB.XdComm.Server.init(xd_receiver.htm>);
FB.CanvasClient.startTimerToSizeToContent();
} ); </script>