Facebook quote application error

假如想象 提交于 2019-12-24 10:45:05

问题


How do I code a Facebook quote application taking its data from PHP/MySQL page generating quotes randomly? I've already developed one, but it's using jQuery which FBML doesn't support and since I'd like the profile tab I'd rather go for FBML instead of iframe.

How to do this without jQuery or using FBJS?

<!DOCTYPE html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <link rel="stylesheet" type="text/css" href="css/jquote.css" />

        <!--<script type="text/javascript" src="scripts/jquery-1.4.2.js"></script>-->

        <script type="text/javascript" src="fbjqry/utility.js"></script>
        <script type="text/javascript" src="fbjqry/fjqry.js"></script>
        <script type="text/javascript">
            // On page load, fill the box with content.
            $(document).ready(function() {
                $("#quoteContainer").load("quote.php");
            });

            var auto_refresh = setInterval(
            function ()
            {
                $('#quoteContainer').load('quote.php');
            }, 5000); // refresh every 10000 milliseconds
        </script>

    </head>

    <div id="wrapper">
        <div class="header">&nbsp;Quote of the Day</div>
        <div id="quoteContainer">
        </div>
    </div>
</html>

回答1:


That's a pretty broad question, but basically you have two options with Facebook. You can make an FBML application, and have your client-side scripting limited to FBJS, or you can make an iframe application, and utilize whatever Javascript libraries you want.

The intermediate solution is to put iframes in your FBML pages using the <fb:iframe> tag. The iframes will let you use full Javascript, but of course you can't modify anything outside the iframe using code from inside it. It can be a good tool though, you just have to design your UI properly.

You mention that you use JQuery, but you don't really say what for. If you're worried about AJAX functionality, FBJS provides that. If you want fancy effects, then you might be out of luck, as FBJS can be pretty limiting.

Another thing to keep in mind is that profile tabs get their own URL, so they can be pointed to completely separate code than the main application. For example, if your main app is served from http://yourapp.com, in the Developer settings you can set the Profile Tab to be at http://yourapp.com/profiletab. There's no reason you couldn't serve out an iframe app as the main application, and just code up some FBML output for the Profile Tab.



来源:https://stackoverflow.com/questions/2624077/facebook-quote-application-error

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!