Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
504 views
in Technique[技术] by (71.8m points)

javascript - window.close(), self.close() not working on mozilla firefox

I want to close window on logout. I have used

  • window.close(),
  • self.close(),
  • var win = window.open("","_self"); win.close();
  • window.parent.close();

These all above i have used that all work in IE but in Mozilla Firefox not working.

Please give me solution for that.

Thanks.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I tried to review all topics about window.close() and have found that: IE/Chrome/Safari(?) accept closure if we open something on _self, so generally

top.open('','_self',''); top.close();

does the work. FF (r 19 when writing this) is more strict about this and somehow forbids any probe like above. The good answer was found in related thread, that user must manually allow FF to have solution above working

about.config -> dom.allow_scripts_to_close_windows = true;

I was quite desperated, as Customer requested window closure on completed operation.

Big bravo to FF dev team. This is exactly how it should work; pity only is that is hard to find it.

Pawel.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...