Skip to content

Instantly share code, notes, and snippets.

@fabianofa
Last active December 19, 2015 05:49
Show Gist options
  • Save fabianofa/5906597 to your computer and use it in GitHub Desktop.
Save fabianofa/5906597 to your computer and use it in GitHub Desktop.
Since adding Pagetabs to Pages is kind of messy, use this code into a HTML simple file. It will allow you to just paste Facebook App ID and Redirect URI then open a pop up with the dialog. Pure and simple use of values on inputs, nothing new or awesome here, just useful.
<!DOCTYPE html:
<html lang="en">
<head>
<title>My Add to Page Dialog Page</title>
</head>
<body>
<div id='fb-root'></div>
<p> Facebook App ID: <input type="text" id="appid" style="width: 350px"> </p>
<p> Redirect URI: <input type="text" id="appuri" style="width: 350px"> </p>
<button id="addaction">Add to Page</button>
<script src='//connect.facebook.net/en_US/all.js'></script>
<script>
// onClick event
document.getElementById( 'addaction' ).onclick = function(){
// Get appId and URI for redirect
var appId = document.getElementById( 'appid' ).value,
appUri = document.getElementById( 'appuri' ).value;
toAdd ='https://www.facebook.com/dialog/pagetab?app_id=' + appId + '&display=popup&redirect_uri=' + appUri;
window.open( toAdd, "Adding to page", "width=620,height=300" )
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment