I built a Web server myself, want to achieve the entire browser minimization,except "JAVA" and "JSP", what method can achieve this effect. There are a lot of examples of browser minimization using "JS" on the internet, but none of them worked for me. Some people mentioned that it might be the ActiveX controls. I don't know what the problem is. Please help me to solve the problem, because I am a rookie, please tell me detailed , thank you very much! Here is an example of using JS for browser minimization that I found on the Internet:

<object id="min" classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11">
<param name="Command" value="Minimize">
</object>
<object id="max" classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11">
<param name="Command" value="Maximize">
</object>

<input type="button" value="minimize" οnclick="min.Click()">
<input type="button" value="maximize" οnclick="max.Click()">

Dani AI

Generated

Short answer: a page running in a normal browser tab cannot reliably minimize the whole browser window across real-world browsers. Browsers intentionally restrict window control and popup behavior for security and user-experience reasons. Given your goal (periodic prompts that do not interrupt browsing), there are three realistic approaches — pick the one that fits your deployment and audience.

Use web notifications (no popup window)

  • For unobtrusive timed prompts, use the Notifications API (optionally via a Service Worker and Web Push). Notifications work even when the page is in the background or the window is minimized once the user grants permission.
  • Example (request permission and show one notification):
Notification.requestPermission().then(p => {
  if (p === 'granted') {
    new Notification('Reminder', { body: 'It is time to check the page.' });
  }
});

See the Notifications API and Service Worker docs for details: Notifications API and Service Worker API.

Build a browser extension (if you need window control)

  • Extensions can change window state (minimized/maximized) with explicit permissions. For example, a background script can call chrome.windows.update(windowId, { state: 'minimized' }), but users must install the extension and grant permissions.
  • Chrome extension windows API: chrome.windows

Create a native/helper app (if you control client machines)

  • A native app or packaged web app (Electron, NW.js, or a native helper) can control OS windows fully. Use this when full window control is required and you can deploy software to the clients. Electron quick-start:

Notes tied to the thread: ’s observation about needing a user gesture for window.open is correct — browsers commonly block non-user-initiated popups. ’s testing advice and ’s cross-browser caution are important: behavior varies widely. And heed ’s point about UX — forcing windows/focus is intrusive and often blocked.

Recommended Answers

All 6 Replies

You must explain what you are doing here. https://www.google.com/search?&q=browser+minimization didn't tell me and I can't guess exactly what you want to do here.

If I take your last discussion as part of the goal this starts to sound like the rather awful advertisement schemes with hidden browser windows, popups or more.

-> Be clear in not only what you want to achieve but why so that there is no doubt in what your question is.

Why are you planning to do this? What purpose does minimizing the browser serve?

Also, ActiveX has been deprecated for over fifteen years - you shouldn't be using it at all. Internet Explorer 10 and later (circa 2012) dropped support for it,. and neither Firefox nor Chrome ever supported it in the first place AFAIK. No modern browsers support ActiveX.

As for the answer, I doubt that there is a single solution that would work on all or even most browsers.

commented: An example was "bitcoin in a web browser so minimize or hide the browser window." +16
commented: only reason I can think of for hiding a popup from the user is if it runs suspicious code in the background... +16

My answer may not be considered helpful in a programming sense, but dear god please don't do this. If there's a top-ten list of most obnoxious website behaviours, this should be on it.

Seriously, what do you want to actually achieve in the long run and why do you think this would help to do that? There may be an all-round better alternative that you haven't considered and may be more doable.

(Moderation Note: Put your company name in your profile and if you wish, tagline.)

I'm sorry that I didn't explain it clearly before, which made everyone misunderstand. My code is just a personal learning test and will not be posted to the internet. I found many browsers in my country, if you call "window.open" directly, it will be blocked, except you call "window.open" with "onclick" in the "button" tag. My purpose is that the people can see a prompt timing, and the prompt will calls the "window.open" of the "button" tag to open a new page, but doesn't affect the user's browsing until the prompt is up.I tried to implement sleep without the button page being closed to make the button page focus periodically,so the button icon will display timing, but failed.But when I tested it, I found that using "window.open" and made the button page at the bottom of all pages, when the browser was minimal ,the button page will become focus.

As part of the learning is what does and does not work. Because of prior bad behavior by advertisers you can't be sure that what you are trying will function. You should find differences across browsers too.

Since there are at least a dozen browsers and possible thousands of settings that can affect this along with pop-up blockers and add-ons when you find something that works (or not) it doesn't mean it will work or not for others.

I want to add a resource or two I use to find out if something works across browsers.

  1. https://caniuse.com
  2. Various W3Schools.com tutorials which often have a "Try it now" button.
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.