如何关闭window.open [英] How to close a window.open
本文介绍了如何关闭window.open的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
TARGET =_top
这是我的代码
$(document).ready(function(){
$('#signin_menu a')。 (){
window.open(
$('#signin_menu a')。attr(href),
'mywindow',
'width = 850,height = 400'
);
return false;
});
})
另外
$('#signin_menu a')。attr(href)
等于
https://graph.facebook.com/oauth/authorize?client_id=145554402127660&display=popup&redirect_uri=http://pgp.dev/fb_receive&scope=publish_stream,rsvp_event,offline_access,email,user_about_me, user_activities,user_birthday,user_events,user_groups,user_inte rest_,user_likes,user_location,user_notes,user_online_presence,user_photo_video_tags,user_status,user_website,read_friendlists
那么怎么办我关闭这个弹出窗口
解决方案
可以使用open()方法返回的创建弹出窗口的close()方法作为对象:
var myPopup;
$(document).ready(function(){
$('#signin_menu a')。click(function(){
myPopup = window。打开(
$('#signin_menu a')。attr(href),
'mywindow',
'width = 850,height = 400');
return false;
});
})
请执行以下操作:
myPopup.close();
I know that you can close a window.open with window.close but is there another way. I have a popup that opens facebook connect and i want to shut the popup whenever the user connects to facebook and then refresh the parent window...I thought in the past i used
TARGET = "_top"
here is my code
$(document).ready(function(){
$('#signin_menu a').click(function (){
window.open(
$('#signin_menu a').attr("href"),
'mywindow',
'width=850,height=400'
);
return false;
});
})
Also
$('#signin_menu a').attr("href")
is equal to
"https://graph.facebook.com/oauth/authorize?client_id=145554402127660&display=popup&redirect_uri=http://pgp.dev/fb_receive&scope=publish_stream,rsvp_event,offline_access,email,user_about_me,user_activities,user_birthday,user_events,user_groups,user_interests,user_likes,user_location,user_notes,user_online_presence,user_photo_video_tags,user_status,user_website,read_friendlists"
So How do i close this popup
解决方案
You can use close() method of created popup that is returned by the open() method as object:
var myPopup;
$(document).ready(function(){
$('#signin_menu a').click(function (){
myPopup = window.open(
$('#signin_menu a').attr("href"),
'mywindow',
'width=850,height=400');
return false;
});
})
To close do the following:
myPopup.close();
这篇关于如何关闭window.open的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文