FB is defined within the facebook javascript library.
Perhaps it is "$FB" as required by the JSNI coding basics guide
On Thu, Mar 21, 2013 at 10:49 AM, Xybek <xybrek@gmail.com> wrote:
On 03/21/2013 09:37 PM, Andy Stevko wrote:
I assume you see it loading facebook's all.js because you see it being
fetched and into the script element facebook-jssdk.
I think the problem is that facebook's js library assumes the DOM is
statically built, scans the document and enhances the proper elements
when loaded.
I once ran into a problem with the facebook scripts needing to be
retriggered so that they would rescan the DOM and modify elements added
dynamically.
After you add your like-box to the DOM, try calling the FB parse method
from within a JSNI wrapper
public static native void reparse(String elementid) /*-{
FB.XFBML.parse(document.getElementById(elementid));
}-*/;
On Thu, Mar 21, 2013 at 1:09 AM, Xybek
<xybrek@gmail.com<mailto:xybrek@gmail.com>> wrote:js = d.createElement(s); js.id <http://js.id> = id;
I have this script which I put on top of the GWT nocache.js
<head>
<script type="text/javascript" language="javascript">
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js.src =
"//connect.facebook.net/en_US/__all.js#xfbml=1
<http://connect.facebook.net/en_US/all.js#xfbml=1>";
fjs.parentNode.insertBefore(__js, fjs);src="app/app.nocache.js"></__script>
}(document, 'script', 'facebook-jssdk'));
</script>
<script type="text/javascript" language="javascript"datahref='http://www.facebook.__com/platform
</head>
<body>
<div id="fb-root"></div>
<div id="rootPanel"></div>
</body>
And on one of the page of the my site (which I use Errai-UI)
This is added on the gwt "page":
HTMLPanel likebox = new HTMLPanel("<div class='fb-like-box'google-web-toolkit+__unsubscribe@googlegroups.com
<http://www.facebook.com/platform>' data-width='595'
data-show-faces='true' data-stream='true' data-header='true'></div>");
likepanel.add(likebox); // Add to the SimplePanel
The problem I am facing is that in my GWT application, when the site
lands on the "page" where this panel is injected, the Facebook like
box doesn't get rendered, even if I look at the DOM, the `<div
class='like-box' ...>` is there in the DOM tree.
What works is that I need to do a full page refresh (in DevMode), on
the currect page: example: `/mysite#PageWithFBDiv`
Also, the page refresh trick only works in DevMode but fails to do
the trick when compiled.
--
You received this message because you are subscribed to the Google
Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to
<mailto:google-web-toolkit%2Bunsubscribe@googlegroups.com>.google-web-toolkit@__googlegroups.com
To post to this group, send email to
<mailto:google-web-toolkit@googlegroups.com>.
Visit this group at
http://groups.google.com/__group/google-web-toolkit?hl=en
<http://groups.google.com/group/google-web-toolkit?hl=en>__.
For more options, visit https://groups.google.com/__groups/opt_out
<https://groups.google.com/groups/opt_out>.
--
-- A. Stevko
===========
"If everything seems under control, you're just not going fast enough."
M. Andretti
--
You received this message because you are subscribed to the Google
Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to
google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to
google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
Thanks, you have a point in your answer, however how where you able to make your reparse method work: I get:
Caused by: com.google.gwt.core.client.JavaScriptException: (ReferenceError): FB is not defined
When reparse() is called. Did you have to include additional JS library?
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
-- A. Stevko
===========
"If everything seems under control, you're just not going fast enough." M. Andretti
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment