Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1102395
  • 博文数量: 1310
  • 博客积分: 3980
  • 博客等级: 中校
  • 技术积分: 8005
  • 用 户 组: 普通用户
  • 注册时间: 2008-05-09 22:05
文章分类

全部博文(1310)

文章存档

2011年(1)

2008年(1309)

我的朋友

分类:

2008-11-09 16:07:09

最近做项目的时候碰到一个问题:
在js里面使用window.close(),IE下工作正常,但是FireFox下有时可以,有时不行。
搜索发现,可以这样解决:
   
  Close   Window
 
在前面加一句  window.open('','_parent','');  
作用为:
fool   the   browser   into   thinking   that   it   was   opened   with   a   script  
  This   opens   a   new   page,   (non-existent),   into   a   target   frame/window,   (_parent   which   of   course   is   the   window   in   which   the   script   is   executed,   so   replacing   itself),   and   defines   parameters   such   as   window   size   etc,   (in   this   case   none   are   defined   as   none   are   needed).   Now   that   the   browser   thinks   a   script   opened   a   page   we   can   quickly   close   it   in   the   standard   way…


seal 2008-04-10 22:51 发表评论
阅读(390) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~