最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Detect Another Application on Browser Window (including percentage overlap) - Stack Overflow

programmeradmin1浏览0评论

Is there a way to detect if an application (say a chat client or msword) is on top of my browser window.

One way is to check for focus. But that does not absolutely say that another program is on top of the "view-able" area of the browser with respect to plete screen.

What if the plete browser is viewable but the focus is on the word document/chat client.

Edit:

Found a sample demo from a pany which does this /

Is there a way to detect if an application (say a chat client or msword) is on top of my browser window.

One way is to check for focus. But that does not absolutely say that another program is on top of the "view-able" area of the browser with respect to plete screen.

What if the plete browser is viewable but the focus is on the word document/chat client.

Edit:

Found a sample demo from a pany which does this http://www.spider.io/vStp83jg6/

Share Improve this question edited Jan 10, 2014 at 18:26 moha297 asked Jan 6, 2014 at 10:23 moha297moha297 1,9121 gold badge17 silver badges16 bronze badges 11
  • 1 The browser won't be able to get that info. If the operating system allows it; then you can run an AIR app on the local machine which can get that info via a NativeProcess/NativeExtension. The AIR app can municate w/ the browser app using a LocalConnection. – JeffryHouser Commented Jan 6, 2014 at 20:41
  • That would need installation of another application on the OS. Which is not feasible in my needs :( – moha297 Commented Jan 7, 2014 at 18:19
  • If browsers were able to do this, I'd replace mine in a hurry. – Diodeus - James MacFarlane Commented Jan 9, 2014 at 4:07
  • theoretically its a privacy violation. But there are panies which claim to be doing this and I am trying to figure out how they do it. – moha297 Commented Jan 9, 2014 at 6:39
  • 1 No browser can do that. But you can use full screen in Flash to ensure there is nothing above. – zenbeni Commented Jan 9, 2014 at 16:58
 |  Show 6 more ments

2 Answers 2

Reset to default 6 +75

I don't think this requires flash or any plugin, in order to be effective this has to be based on CSS and Javascript.

The security sandbox of the browser prevents accessing this information from the operating system.

The only thing that they can be doing consistently across browsers is to detect some sort of side effect of the fact that the browser window is hidden by another window.

One of the side effects that can be detected is if browser rendering optimizations for painting elements have kicked in or not.

According to the spider.io viewability video, they are already detecting if an add is visible based on browser rendering optimizations detection.

If an add is not visible, then for that section of the page rendering optimizations kick in and the rendering of that section of the page will bee slower, in order to save memory and CPU resources, and speed up the rendering of the visible portion of the page.

This same technique could be used to detect if a browser window is hidden or not.

If they detect that rendering optimizations are ongoing in several regions like the 4 corners of the visible viewport and the center of the page they can safely assume that the app is hidden by another external app, or calculate an estimation for the percentage overlap.

They don't say how they do it in detail, but as it's based on speed measurements it might be something like this:

One way that could be used for detecting if another window is hiding the browser:

Create a small invisible CSS3 or Javascript based animation that animates invisible elements in different parts of the page. The animations should not affect the performance of the page and can be started/stopped at will.

Measure the timings of the animation at page startup, and take an average. If the page get's hidden by another OS window, then the rendering optimizations kick in and the time that the animation takes to run is longer.

Check here a browser API to detect the start and stop of CSS3 animations, this could be a way to implement this.

  1. Commercial web traffic data harvested by pany such as Alexa. Is performed by installed software, such as toolbars. And tracks the users activity, programs, windows open.... everything... (with consent)
  2. Controversial answer, it does the above without consent (spyware?)

Note the key point of the above 2 method. is that the data es from a sample of puters in which the software is installed. Not every visitor of the site (unless visiting the site inserts the spyware)

By having custom software installed. They can get around all the respective browser related restrictions / security.

Perhaps more can be found by providing information on the panies that claim to do this?

发布评论

评论列表(0)

  1. 暂无评论