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

前端 未结 6 1950
无人及你
无人及你 2020-11-30 10:19

I want to close window on logout. I have used

  • window.close(),
  • self.close(),
  • var win = window.open(\"\",\"_s
6条回答
  •  甜味超标
    2020-11-30 10:44

    Working 100 % for me

    In Mozilla by default the "dom.allow_scripts_to_close_windows" value which controls the Java Script close window is set to "false". In order to fix this issue change this value to "true"

    Location of the File:

    C:\Program Files\Mozilla Firefox\greprefs\all.js

    change "dom.allow_scripts_to_close_windows" from "false" to "true"

    Example:

    Default value

    pref("dom.allow_scripts_to_close_windows", false);

    Change it to:

    pref("dom.allow_scripts_to_close_windows", true);

    2.Close Mozilla browser

    3.Try accessing HTML page which has window.close() code snippet

    Note : If you not find "all.js" then go to C:\Program Files (x86)\Mozilla Firefox\defaults\pref\channel-prefs.js and add "pref("dom.allow_scripts_to_close_windows", true);" into "channel-prefs.js" file

提交回复
热议问题