Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
badreg

Detecting child windows of a browser window

Recommended Posts

Posted · Original PosterOP

Is it possible for a web app (presumably Javascript) to detect a list of child windows of the browser window that it is running on? I am using Firefox with no plugins. I want to create a child window of the browser window to monitor the app's activity, but I don't want the server to be able to detect this.

 

I am guessing that it is not possible to call something like

EnumChildWindows()

with browser Javascript, but if someone who is more knowledgeable can confirm this, I would greatly appreciate it. Thank you!

Link to post
Share on other sites

There is a jQuery library called duplicate.js which you can find here. Once enabled, you can call

$(document).ready(function () {
	if (window.IsDuplicate()) {
    	console.log("I did a thing!");
	}
});

Let me know if that works for you!

 

Update: Here's a promising API that's native in JS: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/windows/getAll


Main Rig: i5-4460, EVGA GTX 1060, Gigabyte GA-H81M-H, 16GB of G.Skill Ripjaws X DDR3 RAM, 120GB Samsung SSD, 1TB Segate SSHD

Other Tech: iPhone XS 64GB, Nintendo 3DS XL (Snapped), Apple Watch Series 2, Airpods, Nintendo Switch, Retro Consoles, Vizio 32" Smart TV

Link to post
Share on other sites
Posted · Original PosterOP

@ImAlsoRan Thank you for your reply! I think that you misunderstood my question (or more likely, I failed to state it clearly).

 

I am creating a window with my own application and making it a child of a Firefox window, like this:

CreateWindowEx(
                    WS_EX_TRANSPARENT | WS_EX_LAYERED, // extended window style
                    fooName, // registered class name
                    fooName, // and window title
                    WS_POPUP, // window style
                    CW_USEDEFAULT, // horizontal position of window
                    0, // vertical position of window
                    600, // window width
                    350, // window height
                    (HWND) hwndOfBrowserWindow, // handle to parent or owner window
                    NULL, // menu handle or child identifier
                    hInstance, // handle to application instance
                    this // sent with WM_CREATE message in CREATESTRUCT
                    );

This child window is not created by Firefox and is not itself a browser window. Can a web app detect that the browser window that it is running in has a child window attached to it through JavaScript (or other means) without escalated privileges?

Link to post
Share on other sites

No, a website can only know/find out about tabs/popups that it opened itself, so it has no way to detect windows that you created using the win32 API.

 

(This assumes that the site doesn't use flash or java applets, which have more privileges and may allow that, but I believe neither are supported in Firefox any more anyway.)


HTTP/2 203

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Newegg

×