$(window).ready(function(){ var FbApi = "912853052165175"; var url = "http%3A%2F%2Fwww.fisherprice.com.tw%2Ftest%2Fpg%2FJsFb.php"; $('body').append( ""+ "window.fbAsyncInit = function() {"+ "FB.init({"+ "appId : '270723386613906',"+ "xfbml : true,"+ "version : 'v2.6'"+ "});"+ "};"+ "(function(d, s, id){"+ "var js, fjs = d.getElementsByTagName(s)[0];"+ "if (d.getElementById(id)) {return;}"+ "js = d.createElement(s); js.id = id;"+ "js.src = '//connect.facebook.net/en_US/sdk.js';"+ "fjs.parentNode.insertBefore(js, fjs);"+ "}(document, 'script', 'facebook-jssdk'));"+ "" ); $('#fb_login').click(function() { DataToStorage(); location.href='https://www.facebook.com/dialog/oauth?client_id='+FbApi+'&scope=email&redirect_uri='+url; //window.open('https://www.facebook.com/dialog/oauth?client_id='+FbApi+'&scope=email&redirect_uri='+url); }); });