www.webdeveloper.com
Results 1 to 9 of 9

Thread: JS error with Facebook "like" button

  1. #1
    Join Date
    Sep 2012
    Posts
    8

    JS error with Facebook "like" button

    Could anyone confirm the error on this page (http://www.ukagriculture.com/crops/oil_seed_rape.cfm) when you mouse over the horizontal DHTML menu, I've updated the page with OpenGraph data to keep the facebook script happy on page load, I now have the menu activation JS error.

    Any ideas as to what is causing the problem?

    I'm using IE8 on an XP system.


    Regards

    Trevor

  2. #2
    Join Date
    Sep 2011
    Location
    Bristol, England, United Kingdom
    Posts
    192
    There is no error for me when mousing over anything, but there is this on page load:

    Code:
    FB.getLoginStatus() called before calling FB.init(). all.js#xfbml=1 (line 54)
    I'm using the latest version of the top-5 browsers, so it may be a compatibility issue. What does your error say?

  3. #3
    Join Date
    Sep 2012
    Posts
    8
    Hi George,

    Are you using IE8? My menu system works OK in Chrome and firefox.

    I can get the same error on this site: http://software.xfx.net/ when I use the menu system. Seems its an issue with facebook code and menu code existing on the same page. If I remove the facebook code the menu system works. I've tried 3 types of "like" link but all cause the same issue.

    Thing is nothing changed my end, just starting playing up!!

    Will keep looking for a solution.

    Cheers.

    Trevor

  4. #4
    Join Date
    Sep 2012
    Posts
    8
    Error:

    Javascript error
    Description: Invalid argument
    Source: http://www.ukagriculture.com/crops/oil_seed_rape.cfm
    Line: 154

    HTH

  5. #5
    Join Date
    Sep 2011
    Location
    Bristol, England, United Kingdom
    Posts
    192
    Can you please post line 154, and also post any code related to it, such as the lines which call any functions that are in question. Also, does this happen to you in all browsers? I'm guessing this is an old version of IE?

  6. #6
    Join Date
    Sep 2012
    Posts
    8
    This is line 154 when view source

    <div id="dmbri" style="position:absolute;">
    <img src="../images/dmb_i.gif" name="dmbif" width="1" height="1" alt="">
    Line:154 <img src="../uka_menus/dmb_m.gif" name="dmbjs" width="1" height="1" alt="">
    </div>

    Facebook code:

    <div id="fb-root"></div>
    <script>(function(d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) return;
    js = d.createElement(s); js.id = id;
    js.src = "//connect.facebook.net/en_GB/all.js#xfbml=1";
    fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));</script>

    Menu code:

    <div id="dmbri" style="position:absolute;">
    <img src="../images/dmb_i.gif" name="dmbif" width="1" height="1" alt="">
    <img src="../uka_menus/dmb_m.gif" name="dmbjs" width="1" height="1" alt="">
    </div>
    <script language="javascript" type="text/javascript">
    var rimPath=null;var rjsPath=null;var rPath2Root=null;function InitRelCode(){var iImg;var jImg;var tObj;if(!document.layers){iImg=document.images['dmbif'];jImg=document.images['dmbjs'];tObj=jImg;}else{tObj=document.layers['dmbri'];if(tObj){iImg=tObj.document.images['dmbif'];jImg=tObj.document.images['dmbjs'];}}if(!tObj){window.setTimeout("InitRelCode()",700);return false;}rimPath=_gp(iImg.src);rjsPath=_gp(jImg.src);rPath2Root=rjsPath+"../";return true;}function _purl(u){return xrep(xrep(u,"%%REP%%",rPath2Root),"\\","/");}function _fip(img){if(img.src.indexOf("%%REL%%")!=-1) img.src=rimPath+img.src.split("%%REL%%")[1];return img.src;}function _gp(p){return p.substr(0,p.lastIndexOf("/")+1);}function xrep(s,f,n){if(s) s=s.split(f).join(n);return s;}InitRelCode();
    </script>
    <script language="javascript" type="text/javascript">
    function LoadMenus() {if(!rjsPath){window.setTimeout("LoadMenus()", 10);return false;}var navVer = navigator.appVersion;
    if(navVer.substr(0,3) >= 4)
    if((navigator.appName=="Netscape") && (parseInt(navigator.appVersion)==4)) {
    document.write('<' + 'script language="javascript" type="text/javascript" src="' + rjsPath + 'nsmenu_crops.js"><\/script\>');
    } else {
    document.write('<' + 'script language="javascript" type="text/javascript" src="' + rjsPath + 'iemenu_crops.js"><\/script\>');
    }return true;}LoadMenus();</script>

    I'm currently using IE8, and yes it works fine in other browsers and newer IE versions too, just not in IE8!!

  7. #7
    Join Date
    Sep 2012
    Posts
    8
    rest of facebook code to display like button:

    <div class="fb-like" style="display:inline; float:right; border:0px solid #000; width:175px" data-href="http://www.ukagriculture.com/crops/oil_seed_rape.cfm" data-send="false" data-width="450" data-show-faces="true"></div>

  8. #8
    Join Date
    Sep 2011
    Location
    Bristol, England, United Kingdom
    Posts
    192
    I'm not sure what to make of the problem. I'm assuming this is an issue with the way the older versions (less standards-compliant versions) handle certain aspects of JavaScript.

    I assumed line 154 referred to line 154 of a JavaScript file, and not the actual source code. I don't think I'm able to solve this problem without actually having the errors and faulty activity in front of me, it's just so hard to figure something like this out without previous experience or hands on tackling of the error in question.

    An invalid argument is obviously referring to one of the function parameters, but which one I can't see. I know of other places where this error can show, for example using the window.open() function in old IE versions will not allow spaces to be present in the windowName parameter (2nd parameter).

    Sorry, but I can't help.

  9. #9
    Join Date
    Sep 2012
    Posts
    8
    Cheers for trying George, do understand its a difficult one.

    Best wishes

    Trevor

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles