<a href="#" id="signinFace" >Sign in With Facebook</a>
<script type="text/javascript">
$(document).ready(function () {
$("#signinFace").click(function () {
$(this).attr('href', 'https://www.facebook.com/dialog/oauth/?client_id=' +
'5649219384156&' +
'redirect_uri=http%3A%2F%2Flocalhost%3A4151%2FMainPage.aspx&' +
'response_type=code&' +
'scope=email,user_birthday,user_location&' +
'display=popup')
});
});
当我click
Sign in With Facebook
时,我应该怎样做,新页面会在新的小标签上打开?我认为帽子display=popup
就足够了。但它在同一个窗口打开。我也试过了<a href="#" id="signinFace" target="_blank" ></a>
,但没有改变。
答案 0 :(得分:1)
试试这个,window.open
无法在新窗口中打开,因此请使用target = "_blank"
<a href="#" id="signinFace" >Sign in With Facebook</a>
<script type="text/javascript">
$(document).ready(function(){
$(".signinFace").click(function(){
$(this).target = "_blank";
window.location= 'URL_HERE';
return false;
});
});
</script>
答案 1 :(得分:0)
试试这段代码:
<a href="#" id="signinFace" >Sign in With Facebook</a>
<script type="text/javascript">
$(document).ready(function () {
$("#signinFace").click(function (e) {
event.preventDefault();
window.open("Your URL HERE",windowName,'height=200,width=150');
});
});
</script>