我有一个使用FBML的Facebook应用程序,我想在我的应用程序页面上包含UserVoice反馈选项卡小部件。我将JavaScript复制并粘贴到我的FBML页面中,但是当Facebook呈现页面时,该JavaScript被删除,因此选项卡不显示。
有没有人有使用Facebook's modified version of JavaScript的经验并让UserVoice标签在FBML页面上工作?
这是JavaScript代码:
<script>
<!--
var uservoiceJsHost = ("https:" == document.location.protocol) ? "https://uservoice.com" : "http://cdn.uservoice.com";
document.write(unescape("%3Cscript src='" + uservoiceJsHost + "/javascripts/widgets/tab.js' type='text/javascript'%3E%3C/script%3E"))
//-->
</script>
<script>
<!--
UserVoice.Tab.show({
/* required */
key: 'callme',
host: 'callme.uservoice.com',
forum: '31286',
/* optional */
alignment: 'left',
background_color:'#f00',
text_color: 'white',
hover_color: '#06C',
lang: 'en'
})
//-->
</script>
答案 0 :(得分:2)
忘掉JavaScript吧。只需包含以下HTML:
<style type="text/css">
#uservoice-dialog
{
display: block;
margin: -2em auto 0 auto;
position: absolute;
text-align: left;
z-index: 100003;
}
#uservoice-overlay
{
background-color: #000;
filter: alpha(opacity=70);
height: 100%;
left: 0;
opacity: .7;
position: absolute;
top: 0;
width: 100%;
z-index: 100002;
}
#uservoice-dialog[id], #uservoice-overlay[id]
{
position: fixed;
}
#uservoice-overlay p
{
color: #ddd;
font: bold 14px arial, sans-serif;
letter-spacing: -1px;
margin: 0;
padding: 5px;
}
#uservoice-dialog #uservoice-dialog-close
{
background-color: transparent;
background-position: 0 0;
background-repeat: no-repeat;
color: #06c;
cursor: pointer;
height: 48px;
position: absolute;
right: -12px;
top: -11px;
width: 48px;
}
* html.dialog-open body
{
height: 100%;
}
* html.dialog-open, * html.dialog-open body
{
overflow: hidden;
}
html.dialog-open object, html.dialog-open embed, * html.dialog-open select
{
visibility: hidden;
}
* html #uservoice-overlay
{
width: 110%;
}
* html #uservoice-dialog #uservoice-dialog-close
{
background: none;
filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='https://uservoice.com/images/icons/close.png');
}
a#uservoice-dialog-close
{
background-image: url(http://cdn.uservoice.com/images/icons/close.png);
}
</style>
<a href="YOUR_USERVOICE_PAGE_URL_HERE" id="uservoice-feedback-tab">Feedback</a>
这应该在您的页面上放置UserVoice选项卡。您可以根据需要自定义CSS。
请注意,这会跳过UserVoice模式对话框(无论如何都不会在Facebook上运行得很好)并将用户直接带到您的UserVoice主页。
答案 1 :(得分:2)
您还可以注册新的UserVoice Facebook标签,该标签允许您将UserVoice直接嵌入到您的Facebook页面中。那可能是最好的解决方案! (完全披露,我是UserVoice的联合创始人)
www.uservoice.com/facebook