Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

New 'version' attribute added to initJS tag to choose API version

  • Loading branch information...
commit 2d46ffb964e4d6d254e6adec2c0652bab08b5b7d 1 parent 3549d4d
Benoit Hediard benorama authored
3  grails-app/taglib/grails/plugin/facebooksdk/FacebookJSTagLib.groovy
View
@@ -30,10 +30,11 @@ class FacebookJSTagLib {
* @attr customSelector (Default to '$')
* @attr channelUrl (Default to provided facebook sdk channel)
* @attr cookie (Default to true)
+ * @attr frictionlessRequests (Default to false)
* @attr locale (Default to server locale)
* @attr status (Default to false)
* @attr xfbml (Default to false)
- * @attr frictionlessRequests (Default to false)
+ * @attr version (Default to '', API v1.0 for app created before April 30th, 2014, API v2.0 for the others)
*/
def initJS = { attrs, body ->
if (!attrs.locale) attrs.locale = RequestContextUtils.getLocale(request)
3  grails-app/views/tags/_init-js.gsp
View
@@ -12,6 +12,7 @@
window.fbAsyncInit = function() {
FB.init({
appId: "${appId}",
+ <g:if test="${version}">version: "${version}", // API version</g:if>
<g:if test="${channelUrl}">channelUrl: "${channelUrl}", // Custom channel URL</g:if>
cookie: <g:if test="${cookie}">true</g:if><g:else>false</g:else>, // enable cookies to allow the server to access the session
oauth: true, // enables OAuth 2.0
@@ -30,7 +31,7 @@
(function() {
var e = document.createElement("script");
- e.src = document.location.protocol + "//connect.facebook.net/${locale}/all.js";
+ e.src = document.location.protocol + "//connect.facebook.net/${locale}/sdk.js";
e.async = true;
document.getElementById("fb-root").appendChild(e);
}());
1  src/docs/ref/tags/initJS.gdoc
View
@@ -29,4 +29,5 @@ Optional attributes are :
* @locale@ Define JS SDK locale (default to server locale).
* @status@ Check login status (default to @false@).
* @xfbml@ Parse XFBML (default to @false@).
+* @version@ API version (default to @''@, API @v1.0@ for app created before April 30th, 2014, API @v2.0@ for the others.
Please sign in to comment.
Something went wrong with that request. Please try again.