如何在C#项目中禁用浏览器的Close(x)按钮 [英] How To disable Close(x) Button of Browser In C# Project

查看:167
本文介绍了如何在C#项目中禁用浏览器的Close(x)按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友,

我正在使用c#Project和on按钮单击打开一个弹出窗口.我想禁用该子浏览器的close(X)按钮.
我该怎么办?

谢谢与问候
GM Hussain

Hello Friends,

I m working on c# Project & on button Click i m opening a pop up window.i want to disable close(X) button of that child browser.
How I Can ?

Thanks & Regards
GM Hussain

推荐答案

您不能(也不能).而且,用这种样式完成的弹出窗口"不是模态的,因此阻止用户关闭它不会对您有帮助(他们仍然可以返回主页并忽略该窗口).

我认为您需要针对Web调整UI设计,而不是尝试使桌面应用程序在浏览器中工作. Web上的弹出窗口通常是行不通的(特别是因为它们被很多用户阻止).

如果您确实认为需要模式弹出窗口,请仔细考虑后,可以通过在整个页面上覆盖一个半透明的div(以防止发生交互作用),然后在该弹出窗口中将其创建为另一个div,来伪造一个浏览器. (它们都应该设置为position:fixed,这样滚动窗口就不会移动它们.)与任何客户端解决方案一样,用户 可以绕过这样的弹出窗口,因此您不应依赖在它上面,但是它可以为交互目的提供一个近似值.再说一次,它不是Web UI中常见的或不受欢迎的功能,因此在执行此操作之前,请确保它是正确的答案.
You can''t (and nor should you be able to). And also, a ''popup window'' done in this style is not modal, so preventing the user from closing it would not help you (they could still come back to the main page and ignore that window).

I think you need to adapt your UI design for the web, instead of trying to make a desktop app work in the browser. Popups on the web are generally not the way to go (particularly as they are blocked by a lot of users).

If you really think you need a modal popup, after thinking about it carefully, you can fake one in-browser by overlaying a semitransparent div over the whole page (to prevent interaction) and then creating your popup as another div over that. (They should all be set to position:fixed so scrolling the window doesn''t move them.) As with any client side solution, the user can bypass such a popup so you shouldn''t rely on it, but it can provide a close approximation for interaction purposes. Again though, it is not a common or well liked feature in web UIs so make sure it it the right answer before doing that.


据我所知!浏览器关闭按钮由浏览器本身控制.
As far as i know we cannot! Browser Close button is controlled by the browser itself.


这篇关于如何在C#项目中禁用浏览器的Close(x)按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆