facebook - javascript is not working in ie8 - Stack Overflow

I have used a fb script to increase a size of canvas. Here is the code..<div id="fb-root"&

I have used a fb script to increase a size of canvas. Here is the code..

<div id="fb-root"></div>

<script type="text/javascript">
    window.fbAsyncInit = function () {
        FB.init({ appId: '171963559525911', status: true, cookie: true, xfbml: true });
        FB.Canvas.setSize({ width: 1500, height: 1500 });
    };

    (function () {
        var e = document.createElement('script');
        e.type = 'text/javascript';
        e.src = document.location.protocol +
                    '//connect.facebook/en_US/all.js';
        e.async = true;
        document.getElementById('fb-root').appendChild(e);
    } ());
</script>

<script src=".4.2.min.js" type="text/javascript"></script>

It is working in all browsers I've tested except IE8. In fact also working in IE9 but not working in IE8.

Please suggest me to solve the issue.

Thanks

I have used a fb script to increase a size of canvas. Here is the code..

<div id="fb-root"></div>

<script type="text/javascript">
    window.fbAsyncInit = function () {
        FB.init({ appId: '171963559525911', status: true, cookie: true, xfbml: true });
        FB.Canvas.setSize({ width: 1500, height: 1500 });
    };

    (function () {
        var e = document.createElement('script');
        e.type = 'text/javascript';
        e.src = document.location.protocol +
                    '//connect.facebook/en_US/all.js';
        e.async = true;
        document.getElementById('fb-root').appendChild(e);
    } ());
</script>

<script src="http://ajax.microsoft./ajax/jquery/jquery-1.4.2.min.js" type="text/javascript"></script>

It is working in all browsers I've tested except IE8. In fact also working in IE9 but not working in IE8.

Please suggest me to solve the issue.

Thanks

Share Improve this question edited May 11, 2011 at 7:22 PrateekSaluja asked May 10, 2011 at 15:02 PrateekSalujaPrateekSaluja 14.9k17 gold badges57 silver badges75 bronze badges 14
  • 3 If you want any help, you're going to have to say what exactly isn't working. Is ie8 throwing an error? What is it? On what line? etc. – Gabe Moothart Commented May 10, 2011 at 15:04
  • 2 What is "all browser"? Firefox? Chrome? Safari? Opera? IE7? IE6? IE5?! – Quentin Commented May 10, 2011 at 15:05
  • It is working in all browser.only IE8 & IE7 – PrateekSaluja Commented May 10, 2011 at 15:06
  • 1 Your script tag for JQuery isn't closed properly </script -- missing the final >. Not sure if that's a copy+paste error in the question or if it's actually a problem in your code? – Spudley Commented May 10, 2011 at 15:14
  • 2 Your example code looks ok to me in ie8 (jsfiddle/bWhyc), something else may be causing the problem. I notice that your error message is being thrown by "activetables.js", which is nowhere in your sample code. Could that be the issue? – Gabe Moothart Commented May 10, 2011 at 15:50
 |  Show 9 more ments

3 Answers 3

Reset to default 2

This is what I use for extending the size of my canvas and it works in all browsers:

<script type="text/javascript" src="http://static.ak.connect.facebook./js/api_lib/v0.4/FeatureLoader.js.php"></script>
<script type="text/javascript">
    FB_RequireFeatures(["CanvasUtil"], function()
    {
      FB.XdComm.Server.init("/xd_receiver.htm?v=2");
      FB.CanvasClient.startTimerToSizeToContent();
    });
    function onWindowResized(info)
    {
      var canvasInfoDiv = document.getElementById("CanvasInfo");
      var text = String.format("window ({0}, {1}), page ({2}, {3}), canvas({4}, {5}), scrollPos({6}, {7}), canvasPos({8}, {9})", 
        info.window.w, info.window.h,info.page.w, info.page.h,
        info.canvas.w, info.canvas.h,
        info.scrollPos.x, info.scrollPos.y,
        info.canvasPos.x, info.canvasPos.y);
      canvasInfoDiv.innerHTML = text;
    }
</script>

You need to have the xd_receiver.htm inside of a publicly accessibly directory as well. Here is the contents of that file:

xd_receiver.htm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3/1999/xhtml" >
<head>
    <title>cross domain receiver page</title>
</head>
<body>
    <script src="http://static.ak.facebook./js/api_lib/v0.4/XdCommReceiver.js?2" type="text/javascript"></script>
</body>
</html>

EDIT:

$(document).ready(function(){
  FB.init({appId:'your-app-id', status:true, cookie:true, xfbml:true});
  $(window).load(function(){
    FB.Canvas.setSize({height:1100});
  });
});

Obviously set the height to whatever the height of your content is. Before I had:

FB.Canvas.setSize({height:$('html').height()});

But IE seems to not like that. Shouldn't have to explicitly set the height #, but had to in this case.

Lets try this one:


$.ajax({

  url: document.location.protocol +'/connect.facebook/en_US/all.js',

  dataType: 'script',

  success: function(){//do anything ...}

});

(function () {
        //doing stuff
    } ());

should be

(function () {
        //doing stuff
    })();

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745143276a4613527.html

相关推荐

  • facebook - javascript is not working in ie8 - Stack Overflow

    I have used a fb script to increase a size of canvas. Here is the code..<div id="fb-root"&

    6小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信