java - Facebook DIV not rendering on page -
I have this script which I placed at the top of the GWT nocache.js
& Lt; Top & gt; & Lt; Script type = "text / javascript" language = "javascript" & gt; (Function (D, S, ID) {var js, fjs = d.getElementsByTagName (s) [0]; if (d.getElementById (id)) returns; JS = D.Socket element (s); js.id = Id; js.src = "//connect.facebook.net/en_US/all.js#xfbml=1"; fjs.parentNode.insertBefore (js, fjs);} (document, 'script', 'facebook-jsddk' )); & Lt; / Script & gt; & Lt; Script type = "text / javascript" language = "javascript" src = "app / app.nocache.js" & gt; & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Div id = "fb-root" & gt; & Lt; / Div & gt; & Lt; Div id = "rootPanel" & gt; & Lt; / Div & gt; & Lt; / Body & gt; And on one of my pages on the page (which I am URIUIUI)
this is added:
HTMLPanel likebox = New HTMLPanel ("& lt; div class = 'fb-like-box'" + "data-href = 'http: //www.facebook.com/platform' Data-width = '595'" + "data -show -faces = 'true' data-stream = 'true' data-header = 'true' & gt; & lt; / div & gt; "); Likepanel.add (likebox); The problem I am facing is that in my GWT application, when there is a ground on the page where this panel is injected, then Facebook is not sung as a box, Even if I see it on the DOM, is in the dog tree. What works for me in a full page refresh (devmod), on the page: Example: / mysite # PageWithFBDiv In addition to this, the page The refresh trick only works in DevMode but it fails to trick the compile. According to the Facebook Javascript SDK documentation, it is necessary to place the Div at the top of the page, ie above the script ie
.
Javascript SDK needs to be present in the FB-Root element in the page.
The FB-Root element should not be hidden by using the display: None or Visibility: hidden, or certain parts of the SDK will not function properly in Internet Explorer.
SDK contains elements in the FB-root, which should be positioned relative to the body or relative of an element close to the upper part of the e-page. It is best if the FB-element is not inside the element with the element: full or condition: relative. If you must keep the FB-Root element inside an element, then it should be located near the body or parts of the SDK, it can not work properly.
This code should be placed directly after the opening tag.
& lt; Div id = "fb-root" & gt; & Lt; / Div & gt; & Lt; Script & gt; Window.fbAsyncInit = function () {// init FB js SDK FB. IIT ({appId: 'YOUR_APP_ID', // App ID from App Dashboard Channel URL: //WWW.YOUR_DOMAIN.COM/channel.html ', // X-Domain Communication Status for Channel: True, in // Login Status Check the login? Cookie: true, // set session cookies to allow your server to use session? Xfbml: true // XFBML tag parsed page on it?}); // Adding additional initialization codes such as event shirores goes here; // Load the source of SDK Asynchronously // Note that the debug version is being actively developed and possibly // is some kind of check which is extremely strict // Please report such a bug using the bug tool . (Function (D, debug) {var js, id = 'facebook-jssdk', ref = d.getElementsByTagName ('script') [0]; if (d.getElementById (id)) {return;} js = d Element ('script'); js.id = id; js.async = true; js.src = "//connect.facebook.net/en_US/all" + (debug? / Debug ":" ") +" .js "; ref.parentNode.insertBefore (js, ref);} (document, / * debug * / false)); & Lt; / Script & gt;
Comments
Post a Comment