【发布时间】:2011-09-08 22:34:58
【问题描述】:
我正在尝试创建一个 Facebook iFrame 应用程序。应用程序应首先显示一张图片,如果用户喜欢该页面,他将可以访问一些内容。
我使用 RoR,因此无法使用 Facebook PhP SDK。
当用户不喜欢该页面时,这是我的 iFrame HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<link rel="stylesheet" type="text/css" href="style.css" />
<style type="text/css">
body {
width:520px;
margin:0; padding:0; border:0;
font-family: verdana;
background:url(repeat.png) repeat;
margin-bottom:10px;
}
p, h1 {width:450px; margin-left:50px; color:#FFF;}
p {font-size:11px;}
</style>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
</head>
<body>
<div id="container">
<img src="welcome.png" alt="Frontimg">
</div>
并且,如果用户喜欢该页面:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<link rel="stylesheet" type="text/css" href="style.css" />
<style type="text/css">
body {
width:520px;
margin:0; padding:0; border:0;
font-family: verdana;
background:url(repeat.png) repeat;
margin-bottom:10px;
}
p, h1 {width:450px; margin-left:50px; color:#FFF;}
p {font-size:11px;}
</style>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
</head>
<body>
<div id="container">
<img src="member.png" alt="Frontimg">
<p>You liked this page</p>
【问题讨论】:
-
是的,我知道 FB JS SDK - 但我不知道如何使用它
-
在我试一试之前还有两个问题:它真的是敏感信息吗?因为一种方法涉及在用户喜欢页面时显示一个带有js的div,如果用户不喜欢页面则显示另一个div(两个div在开始时都隐藏在页面中)所以有人可以用firebug或其他东西取消隐藏它们查看您的内容。另一种方法涉及通过更“安全”的 ajax 获取两个 div 的内容。还有你用什么 JS 库我是 jquery'ist 所以我可以用 jquery 吗?
标签: javascript jquery ruby-on-rails ruby-on-rails-3 facebook