window.close()javascript无法正常工作

编程入门 行业动态 更新时间:2024-10-25 04:14:39
本文介绍了window.close()javascript无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

function fnConfirm() { var answer = confirm("really want to close the window"); if (answer) { window.close(); } else { }

和关闭按钮事件

and on close button event

this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "xx", "<script>fnConfirm();</script>");

但问题在于,只有确认框弹出,然后单击确定",没有任何反应, 提交此问题的解决方案后,请告诉我如何仅关闭打开窗口的选项卡,如果已经打开了许多选项卡,则不关闭浏览器. 在此先感谢

but the problem is that, only confirmation box pop ups and on click ok nothing happens, and after submitting the solution of this problem please tell me how to close only the Tab in which the window is opened, not browser if there are many tabs opened already. thanks in advance

推荐答案

我有解决方法.. 问题不在于代码,Mozilla firefox不允许用户关闭脚本窗口. 但我们可以更改配置 1.在地址栏中输入about:config并输入. 2.确保您的"dom.allow_scripts_to_close_windows"为真 如果不是,则将其更改为true. 现在脚本可以在Mozilla firefox上正常工作. i got solution.. problem is not with the code, Mozilla firefox does not allow users to close window on script. but we can change configuration 1. type about:config in address bar and enter. 2. make sure your "dom.allow_scripts_to_close_windows" is true if not then change it to true. now scripts work fine on Mozilla firefox.

更多推荐

window.close()javascript无法正常工作

本文发布于:2023-11-09 15:34:49,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1572746.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:无法正常   工作   window   close   javascript

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!