So what I’m trying to do is get the content in <div id=content> to show if the page has been “liked”. I got it to work if the user has just pressed the like button, but if the page refreshes, or the user comes back at a later time, it remembers that the user likes the page (of course), but it does not show the content in <div if=content> unless the user unlikes and then likes the page again. Im guessing this is because what the code is referencing is some sort of click event, rather than if the page is liked or not.
Here is the link:
Here is the code:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:og="http://ogp.me/ns#"
xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>WD Fan Page</title>
<meta property="og:title" content="WD Fan Page"/>
<meta property="og:type" content="company"/>
<meta property="og:url" content="jackthe7th.dyndns.org/test"/>
<meta property="og:site_name" content="WD Fan Page"/>
<meta property="fb:admins" content="560504907"/>
<meta property="og:description"
content=" fan page Like"/>
<script type="text/javascript" src="jquery.js"></script>
<style type="text/css">
#content {
display: none;
padding: 20px 0 0 0;
}
</style>
</head>
<body>
<h1>WD Fan Page</h1>
<div id="fb-root"></div>
<p><fb:login-button autologoutlink="true"></fb:login-button></p>
<p><fb:like></fb:like></p>
<script>
window.fbAsyncInit = function() {
FB.init({appId: '205453252832209',
status: true,
cookie: true,
xfbml: true});
FB.Event.subscribe('auth.login', function() {
window.location.reload();
});
FB.Event.subscribe('edge.create', function(href, widget) {
jQuery('#content').show();
});
FB.Event.subscribe('edge.remove', function(href, widget) {
jQuery('#content').hide();
});
};
(function() {
var e = document.createElement('script');
e.type = 'text/javascript';
e.src = document.location.protocol +
'//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
</script>
<div id="content"> This content shows up when user likes page <br />
if you unlike this page it will go away!
</div>
</body>
</html>