[译]OxFF-阻止弹出窗口的另一种方法
By robot-v1.0
本文链接 https://www.kyfws.com/applications/oxff-another-way-to-block-popups-zh/
版权声明 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
- 7 分钟阅读 - 3344 个词 阅读量 0[译]OxFF-阻止弹出窗口的另一种方法
原文地址:https://www.codeproject.com/Articles/9262/OxFF-Another-way-to-block-popups
原文作者:Mircea Puiu
译文由本站 robot-v1.0 翻译
前言
Popup blocker with source code.
带有源代码的弹出窗口阻止程序.
介绍(Introduction)
令人讨厌的弹出广告实际上已经在我们钟爱的Internet上爆炸了.尽管如此,流行的阻挡者,杀手(或他们可能被称为杀手)也一直在"爆炸".他们中的大多数是为了某些费用而来找我们,其他则是免费的.他们中的一些人过多地控制了我们的冲浪,有时不弹出合法的窗口.其他的则太复杂了,为我们提供了很多选项列表和设置,这些选项和设置可能与不同的冲浪环境不符.(The annoying popup ads have literally exploded on our beloved Internet. Nonetheless, the pop blockers, killers (or however they may be called) have also been “exploding”. Most of them come to us against some costs, others are for free. Some of them take too much control of our surfing, not letting legitimate windows pop up sometimes. Others are too complex, providing us with a lot of option lists and settings which may not match the different contexts of surfing.)
无论如何,软件人员在这方面做得很好,如果不是100%的用户感到满意,他们也不应责备.这将永远不会发生!如果您需要弹出式窗口杀手评论,则可以找到有用的信息(Anyway, software people are doing a real good work on that, and they are not to blame if not a 100% of the users are happy. This will never happen! Should you need a popup killer review, you can find useful information) 这里(here) .我个人认为XP附带的防火墙软件在这一感兴趣的领域做得很好.(. My personal opinion is that the firewall software suit accompanying XP does a wonderful job in this area of interest.)
CP社区内提供了出色的编码方法及其附带的注释.其中最相关(按字母顺序排列)的提供者:(Excellent coding approaches along with their accompanying comments are provided within CP community. Most relevant of them (in alphabetical order) are provided by:)
- 约翰`奥斯本(John Osborn)
- 帕勃罗`范德米尔(Pablo van der Meer)
- 斯蒂芬`罗德里格斯(Stephane Rodriguez)(Stephane Rodriguez)
- 张小林(Xiaolin Zhang)
**血氧(OxFF)**结合了新的方法,(comes with a new approach which combines the versatility of the)
IWebBrowser2
与DirectX技术的后台支持进行交互.在家庭或办公室网络中工作的人们可能会发现此工具很有用.相关的建设性反馈将受到高度赞赏.辩论可能比该工具本身更有用.(interface with the background support of the DirectX technology. People working within home or office networks may find this tool useful. Pertinent, constructive feedback will be highly appreciated. A debate might prove to be of greater use than this tool itself.)
让Year Year 2005帮助您保持良好状态,充满成功并且没有弹出窗口!(Let Year 2005 help you being in good shape, full of success, and free of popups!)
使用OxFF(Using OxFF)
**血氧(OxFF)**在以下假设下工作:(works with the following assumption:)合法的弹出窗口是通过鼠标单击浏览器页面内的HTML元素而打开的新窗口(A legitimate popup window is a new window opened as a result of a mouse click on an HTML element within a browser page).(.)
**血氧(OxFF)**一次只允许一个浏览器实例工作,停止任何其他尝试打开一个新实例的尝试.如果出现合法的弹出窗口,它将打开新窗口,但会杀死前一个窗口,并记住其"导航" URL的"后退"功能.停止弹出窗口的数量显示在(allows only one browser instance work at a time, stopping any other attempt to open a new one. In case of a legitimate pop-up, it opens the new window, but kills the previous one, memorizing its “navigated” URL for “Back” functionality. The number of stopped popups is displayed at the bottom of)血氧(OxFF).(.)
**DirectX 8(DirectX 8)**或更高版本必须安装在您的计算机上.从以下位置下载DirectX 9:(or higher must be installed on your computer. Download DirectX 9 from the) 微软网站(Microsoft site) .(.)
以下命令可用(The following commands are available):(:)
-
双击垃圾桶(Double click on the trash bin)禁用启用(Disable / enable)血氧(OxFF).(.)
-
左键点击垃圾桶(Left click on the trash bin)清空垃圾箱并重置弹出计数器.(Empty the bin and reset the popup counter.)
-
右键单击垃圾箱(Right click on the trash bin)在合法的弹出窗口中导航到该弹出窗口被允许显示时被杀死的窗口使用的URL(“后退"功能).(Navigate within the legitimate popup window to the URL used by the window killed when this popup was allowed to show up (“back” functionality).)
-
ESC,当OxFF的窗口处于活动状态(即选中)时(ESC, when OxFF’s window is active (i.e. selected))关(Close)血氧(OxFF).(.)
注意(Note):(:)合法的弹出窗口是新的,没有导航历史记录.因此,其"后退"按钮被禁用.这就是为什么"后退"功能由(A legitimate popup window has no navigation history, as it is new. Therefore, its “Back” button is disabled. That is why the “back” functionality is provided by)血氧(OxFF).(.)
怎么运行的(How it works)
从逻辑上讲(Logically,)**血氧(OxFF)**由两个模块构成:(is structured in two modules:)
- 一个模块跟踪您计算机上注册的Web浏览器实例(One module keeps track of the web browser instances registered on your computer)
- 另一个模块轮询鼠标状态(位置和按钮)(*Another module polls the mouse state (position and buttons)) 有关跟踪已注册浏览器实例的更多信息,请参见我有关以下内容的文章:(More information on keeping track of the registered browser instances can be found in my article concerning the*) “Style Inspector”)“样式检查器”( .(.)
**血氧(OxFF)**只允许一个浏览器实例.实例跟踪模块会强制退出任何其他实例.请注意(allows only one browser instance. Any further instance is forced to quit by the instance tracking module. Please notice that)**血氧(OxFF)**甚至将您(在启动另一个Internet Explorer会话时)创建的新浏览器实例都视为非法弹出窗口.请记住,您可以禁用(will treat even a new browser instance created by you (when starting another Internet Explorer session) as a non-legitimate popup. Remember, you can disable)**血氧(OxFF)**随时.重新启用时(at any time. When re-enabling)血氧(OxFF),任何新的弹出窗口都将被拦截,并且只有第一个打开的浏览器实例将保持活动状态.(, any new popup will be intercepted and only the very first opened browser instance will be kept alive.)
问题是(The question is):(:)**当必须显示一个合法的新窗口时会发生什么?(what happens when a legitimate new window must show up?)**例如,我正在工作的公司的邮件服务器系统就是这种情况.输入我的电子邮件后,当我单击"收件箱"项时,会打开一个新窗口.这绝对是一个合法的弹出窗口!(This is the case, for example, of the mail server system of the company I am working for. After entering my e-mail box, a new window opens when I click the “Inbox” item. And this is definitely a legitimate pop-up!)
基于DirectX技术的鼠标状态轮询模块负责处理此类情况.轮询时(在后台),该模块获取两个窗口处理程序:(The mouse state polling module, based on the DirectX technology, is responsible for treating these kind of situations. When polling (in the background), the module gets two window handlers:)
- 通过调用前景窗口(即用户当前正在使用的窗口)的处理程序(A handler to the foreground window (i.e., of the window the user is currently working with), by calling)
- 通过使用指向浏览器实例的指针来处理浏览器主窗口的处理程序(将其设置为(A handler to the main window of the browser, by using a pointer to the browser instance (let it be)
IWebBrowser2* lpBrowser
)并致电:() and by calling:) 如果这两个处理程序相同,则任何左键单击都与使用浏览器窗口(而不是与可能同时运行的其他应用程序)相关.(In case those two handlers are the same, any left mouse click is related to working with the browser window (and not with other applications that may be running at the same time).)血氧(OxFF)“打开"一个信任时间窗口,其中的弹出窗口变为合法,并启动两个超时计数器(一个用于关闭合法化标志,另一个用于"关闭"信任时间窗口),当用户在浏览器窗口中单击,但是单击的结果通常不是新窗口.允许显示弹出窗口的"信任"时间为1秒.我希望在这里进行讨论(当然是受欢迎的).当出现合法弹出窗口时,(“opens” a trust time-window, in which a popup becomes legitimate, and starts two timeout counters (one to turn off a pre-legitimation flag and a second one to “close” the trust time-window) that are useful when the user clicks within the browser window, but the result of the click is normally not a new window. The “trust” time, during which a popup is allowed to show up, is 1 second. I expect discussions here (which are welcome, of course). When a legitimate popup shows up,)**血氧(OxFF)**记住到目前为止该浏览器实例使用的URL,强制该实例退出,并使新的浏览器实例正常工作(因此列表中仍然只有一个).由于记忆的URL,现在可以返回到生成合法化弹出窗口过程的网页.通过右键单击弹出的垃圾箱,用户指示(memorizes the URL used by the browser instance up to that point, forces that instance to quit, and makes the new browser instance the working one (so still only one in the list). Going back to the web page that generated the process of legitimating the popup window is possible now because of the memorized URL. By right clicking the popup trash bin, the user instructs)**血氧(OxFF)**在当前浏览器实例中导航到该URL.(to navigate to that URL within the present browser instance.)
历史(History)
创建于:2005年1月.(Created: January, 2005.)
许可
本文以及所有相关的源代码和文件均已获得The Code Project Open License (CPOL)的许可。
C++ HTML VC6 WinXP Windows Win2K Visual-Studio Dev 新闻 翻译