Jump to content

Detecting child windows of a browser window

badreg

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 comment
Share on other sites

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

Quote or mention me or I won't be notified of your reply!

Main Rig: R7 3700x New!, EVGA GTX 1060 6GB, ROG STRIX B450-F Gaming New!, Corsair RGB 2x16GB 3200MHz New!, 512GB Crucial P5, 120GB Samsung SSD, 1TB Segate SSHD, 2TB Barracuda HDD

MacBook Pro 14" (M1 Max, 32GB RAM)

Links: My beautiful sketchy case | My website

Link to comment
Share on other sites

Link to post
Share on other sites

@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 comment
Share on other sites

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 comment
Share on other sites

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

×