<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>
,但没有改变。
试试这个,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>
试试这段代码:
<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>