Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Set 'version' attribute as required in initJS tag

  • Loading branch information...
commit daf2140da7b2ebbdc876be0023fc7c300a21663b 1 parent 456becd
@benorama benorama authored
View
2  grails-app/taglib/grails/plugin/facebooksdk/FacebookJSTagLib.groovy
@@ -25,6 +25,7 @@ class FacebookJSTagLib {
* Initialize Facebook JS SDK
*
* @attr appId REQUIRED
+ * @attr version REQUIRED (API v1.0 for app created before April 30th, 2014, API v2.0 for the others)
* @attr autoGrow (Default to false)
* @attr channel (Default to true)
* @attr customSelector (Default to '$')
@@ -34,7 +35,6 @@ class FacebookJSTagLib {
* @attr locale (Default to server locale)
* @attr status (Default to false)
* @attr xfbml (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)
View
2  grails-app/views/tags/_init-js.gsp
@@ -12,7 +12,7 @@
window.fbAsyncInit = function() {
FB.init({
appId: "${appId}",
- <g:if test="${version}">version: "${version}", // API version</g:if>
+ version: "${version}", // API version
<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
View
2  src/docs/ref/tags/initJS.gdoc
@@ -20,6 +20,7 @@ h3. Attributes
Required attribute is :
* @appId@ Facebook app id
+* @version@ API version (API @v1.0@ for app created before April 30th, 2014, API @v2.0@ for the others.
Optional attributes are :
* @autoGrow@ Call @FB.setAutoGrow()@ after page rendering (default to @false@).
@@ -29,5 +30,4 @@ 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.

3 comments on commit daf2140

@PatrickHuetter

Does this fix the problems with "Uncaught Error: init not called with valid version" ? I get this message only in production environment on my server. Offline everything is working.

@PatrickHuetter

Yes it does (tested it).

@benorama
Owner

Indeed, to be backward compatible between Graph V1.0 et V2.0, you need to specify the version.

Please sign in to comment.
Something went wrong with that request. Please try again.