Hook into tab changed event of browser

て烟熏妆下的殇ゞ 提交于 2019-12-08 05:34:06

问题


In an ongoing project (Windows, .NET C#) we encountered a bottleneck in our development: we have to observe the change of the current tab in all major browsers (IE,FF, Chrome, Opera, Safari).

As soon as tab change event has been captured, it must be written to a file.

Is this feasible?


回答1:


What i finally did was the following:

tracked the EVENT_OBJECT_NAMECHANGE for the Window title

as soon as the title gets changed i know there was something "new" loaded, so i checked for the URL of the browser using various techniques (nDDE for Firefox and Opera, checking for a specific Window Class for Chrome, etc...! Thorsten is right by saying that it's impossible, so i implemented only for the major browsers)




回答2:


I don't know how this should be done... One thing you could try is to find the window handle of the browser's tab control and hook into it, but that's quite a nasty task. And there's no guarantee that they don't use a custom tab control, so I'd say this can't be done.

Can you give some more information on why you need this? Maybe there's some other solution you didn't think of?




回答3:


You can combine these two to get what you want:

Is there a way to detect if a browser window is not currently active?

And:

Javascript; communication between tabs/windows with same origin



来源:https://stackoverflow.com/questions/14436215/hook-into-tab-changed-event-of-browser

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!