Ordinary javascript cannot close windows willy-nilly. This is a security feature, introduced a while ago, to stop various malicious exploits and annoyances. Show
From the latest working spec for
This means, with one small exception, javascript must not be allowed to close a window that was not opened by that same javascript. Chrome allows that exception -- which it doesn't apply to userscripts -- however Firefox does not. The Firefox implementation flat out states:
If you try to use The long-term solution:The best way to deal with this is to make a Chrome extension and/or Firefox add-on instead. These can reliably close the current window. However, since the security risks, posed by The hacky workarounds:Chrome is currently was vulnerable to the "self redirection" exploit. So code like this used to work in general:
This is buggy behavior, IMO, and is now (as of roughly April 2015) mostly blocked. It will still work from injected code only if the tab is freshly opened and has no pages in the browsing history. So it's only useful in a very small set of circumstances. However, a variation still works on Chrome (v43 & v44) plus Tampermonkey (v3.11 or later). Use an explicit
Thanks to zanetu for the update. Note that this will not work if there is only one tab open. It only closes additional tabs.
You can open up If your script is for personal use, go ahead and do that. If you ask anyone else to turn that setting on, they would be smart, and justified, to decline with prejudice. There currently is no equivalent setting for Chrome. Lesson 9: Understanding Applications/en/computerbasics/understanding-operating-systems/content/ What is an application?You may have heard people talking about using a program, an application, or an app. But what exactly does that mean? Simply put, an app is a type of software that allows you to perform specific tasks. Applications for desktop or laptop computers are sometimes called desktop applications, while those for mobile devices are called mobile apps. When you open an application, it runs inside the operating system until you close it. Most of the time, you will have more than one application open at the same time, which is known as multi-tasking. App is a common term for an application, especially for simple applications that can be downloaded inexpensively or even for free. Many apps are also available for mobile devices and even some TVs. Watch the video below to learn more about applications. Looking for the old version of this video? You can still view it here. Desktop applicationsThere are countless desktop applications, and they fall into several categories. Some are more full featured (like Microsoft Word), while others may only do one or two things (like a clock or calendar app). Below are just a few types of applications you might use.
Mobile appsDesktop and laptop computers aren't the only devices that can run applications. You can also download apps for mobile devices like smartphones and tablets. Here are a few examples of mobile apps.
Installing new applicationsEvery computer and mobile device will come with some applications already built in, such as a web browser and
media player. However, you can also purchase and install new apps to add more functionality. You can review our lessons on Installing Software on Your Windows PC, Installing Software on Your Mac, and
Free Software to learn more. /en/computerbasics/setting-up-a-computer/content/ Which feature of an OS provides a method for users to interact with the computer?User interface - The features of a computer system which allows the user to interact with it. A user interface, also sometimes called a human-computer interface, comprises both hardware and software components. It handles the interaction between the user and the system.
Which OS is used the most on modern user desktop computers in business environments?For desktop and laptop computers, Windows is the most used at 74%, followed by Apple's macOS at 14%, and Linux-based operating systems, at 5% (i.e. "desktop Linux" at 2.84%, plus Google's ChromeOS at 2%, in the US up to 4.43%).
What happens on a computer that runs a cooperative multitasking OS?Cooperative multitasking is a type of computer multitasking in which the operating system never initiates a context switch from a running process to another process. It interrupts applications and gives control to other processes outside the application's control.
What is preemptive multitasking in OS?Preemptive multitasking is a type of multitasking that allows computer programs to share operating systems (OS) and underlying hardware resources. It divides the overall operating and computing time between processes, and the switching of resources between different processes occurs through predefined criteria.
|