找了很多,最后还是这个方法管用。
方法一 (js):
newWindow=window.open (’http://www.baidu.com’, “anyname”, “fullscreen=1″) ;
window.opener=null;
window.open(”",”_self”);
window.close();
方法二 (后台返回代码):
string script = "window.open('http://www.baidu.com','_blank','fullscreen=1');window.opener=null;window.open('','_self');window.close();";
现在解决IE,Firefox兼容问题,之所以window.close在firefox不能使用,是因为firefox默认不能关闭用户打开的网页,我们可以这样设置firefox:打开firefox,在地址栏输入about:config
找到dom.allow_scripts_to_close_windows这项并改为true。
现在知道为什么了吧。众所周知,在javascript中window.close()是用来关闭窗口的,而且ie和firefox都是支持的。