Pop up note windows

Popups and window methods

A popup window is one of the oldest methods to show additional document to user.

Basically, you just run:

…And it will open a new window with given URL. Most modern browsers are configured to open url in new tabs instead of separate windows.

Popups exist from really ancient times. The initial idea was to show another content without closing the main window. As of now, there are other ways to do that: we can load content dynamically with fetch and show it in a dynamically generated

Also, popups are tricky on mobile devices, that don’t show multiple windows simultaneously.

Still, there are tasks where popups are still used, e.g. for OAuth authorization (login with Google/Facebook/…), because:

  1. A popup is a separate window which has its own independent JavaScript environment. So opening a popup from a third-party, non-trusted site is safe.
  2. It’s very easy to open a popup.
  3. A popup can navigate (change URL) and send messages to the opener window.

In the past, evil sites abused popups a lot. A bad page could open tons of popup windows with ads. So now most browsers try to block popups and protect the user.

Most browsers block popups if they are called outside of user-triggered event handlers like onclick .

This way users are somewhat protected from unwanted popups, but the functionality is not disabled totally.

What if the popup opens from onclick , but after setTimeout ? That’s a bit tricky.

The popup opens in Chrome, but gets blocked in Firefox.

…If we decrease the delay, the popup works in Firefox too:

The difference is that Firefox treats a timeout of 2000ms or less are acceptable, but after it – removes the “trust”, assuming that now it’s “outside of the user action”. So the first one is blocked, and the second one is not.

window.open

The syntax to open a popup is: window.open(url, name, params) :

url An URL to load into the new window. name A name of the new window. Each window has a window.name , and here we can specify which window to use for the popup. If there’s already a window with such name – the given URL opens in it, otherwise a new window is opened. params The configuration string for the new window. It contains settings, delimited by a comma. There must be no spaces in params, for instance: width=200,height=100 .

Settings for params :

  • Position:
    • left/top (numeric) – coordinates of the window top-left corner on the screen. There is a limitation: a new window cannot be positioned offscreen.
    • width/height (numeric) – width and height of a new window. There is a limit on minimal width/height, so it’s impossible to create an invisible window.
  • Window features:
    • menubar (yes/no) – shows or hides the browser menu on the new window.
    • toolbar (yes/no) – shows or hides the browser navigation bar (back, forward, reload etc) on the new window.
    • location (yes/no) – shows or hides the URL field in the new window. FF and IE don’t allow to hide it by default.
    • status (yes/no) – shows or hides the status bar. Again, most browsers force it to show.
    • resizable (yes/no) – allows to disable the resize for the new window. Not recommended.
    • scrollbars (yes/no) – allows to disable the scrollbars for the new window. Not recommended.
Читайте также:  Основные команды linux для управления каталогами

There is also a number of less supported browser-specific features, which are usually not used. Check window.open in MDN for examples.

Example: a minimalistic window

Let’s open a window with minimal set of features, just to see which of them browser allows to disable:

Here most “window features” are disabled and window is positioned offscreen. Run it and see what really happens. Most browsers “fix” odd things like zero width/height and offscreen left/top . For instance, Chrome open such a window with full width/height, so that it occupies the full screen.

Let’s add normal positioning options and reasonable width , height , left , top coordinates:

Most browsers show the example above as required.

Rules for omitted settings:

  • If there is no 3rd argument in the open call, or it is empty, then the default window parameters are used.
  • If there is a string of params, but some yes/no features are omitted, then the omitted features assumed to have no value. So if you specify params, make sure you explicitly set all required features to yes.
  • If there is no left/top in params, then the browser tries to open a new window near the last opened window.
  • If there is no width/height , then the new window will be the same size as the last opened.

Accessing popup from window

The open call returns a reference to the new window. It can be used to manipulate it’s properties, change location and even more.

In this example, we generate popup content from JavaScript:

And here we modify the contents after loading:

Please note: immediately after window.open , the new window isn’t loaded yet. That’s demonstrated by alert in line (*) . So we wait for onload to modify it. We could also use DOMContentLoaded handler for newWin.document .

Windows may freely access content of each other only if they come from the same origin (the same protocol://domain:port).

Otherwise, e.g. if the main window is from site.com , and the popup from gmail.com , that’s impossible for user safety reasons. For the details, see chapter Cross-window communication.

Accessing window from popup

A popup may access the “opener” window as well using window.opener reference. It is null for all windows except popups.

If you run the code below, it replaces the opener (current) window content with “Test”:

let newWin = window.open(«about:blank», «hello», «width=200,height=200»); newWin.document.write( «

Comments

  • If you have suggestions what to improve — please submit a GitHub issue or a pull request instead of commenting.
  • If you can’t understand something in the article – please elaborate.
  • To insert few words of code, use the tag, for several lines – wrap them in
Читайте также:  Обновление lumia 535 до windows 10 с помощью компьютера

tag, for more than 10 lines – use a sandbox (plnkr, jsbin, codepen…)

On-screen keyboard keeps popping up in Windows 10 [QUICK FIX]

Some users have stated on forums that Windows 10‘s on-screen keyboard keeps popping up. The on-screen keyboard pops up on the login screen each time they boot up.

It can also pop up more randomly when users open various windows. This is how you can fix an on-screen keyboard that pops up with some regularity in Windows 10.

The on-screen keyboard pops up automatically

1. Turn Off the On-Screen Keyboard Settings

You can usually fix an on-screen keyboard that keeps popping up by adjusting the on-screen keyboard settings. Note that Windows 10 includes on-screen keyboard settings in both the Settings app and Control Panel.

You can switch the on-screen keyboard off via both the Settings app and Control Panel as follows:

  1. Press the Type here to search button on the taskbar to open Cortana.
  2. Enter the keyword ‘ease of access’ in Cortana’s search box.
  3. Select Ease of access keyboard settings to open the window shown directly below.
  4. Toggle the Turns on the On-Screen Keyboard option off if it’s on.
  5. To check the Use on-screen keyboard setting in the Control Panel, enter ‘ease of access’ in Cortana.
  6. Select Ease of Access to open the Control Panel window as in the snapshot below.
  7. Click Use the computer without a mouse or keyboard option to open the settings shown directly below.
    Image
  8. Deselect the Use On-Screen Keyboard option, and remember to press the Apply the OK buttons.

If you need to use a professional onscreen keyboard but the default one from Windows has this pop-up issue, we strongly recommend you Comfort Onscreen Keyboard Pro. Highly rated by customers, this is a great tool that you can try for free from the official Comfort Software website.

You can’t open Control Panel on Windows 10? Check out this step-by-step guide to find a solution.

2. Remove Software From the System Startup

Some programs automatically open the on-screen keyboard in Windows 10. So the keyboard might be popping up on your desktop or laptop because of recently installed third-party software.

As such, disabling third-party programs is a potential resolution. This is how you can disable startup software in Win 10:

  1. To open Task Manager, press the Windows key + X and selectTask Manager.
  2. Then click the Start-up tab in Task Manager.
  3. You can only disable third-party programs one at a time in Task Manager. So select a third-party program, and press the Disable button.

Alternatively, you could clean boot Windows. Clean booting Windows will automatically get rid of all the third-party software startup items and services. You can clean boot Windows 10 as follows.

  1. Press the Windows key + R hotkey.
  2. Input ‘msconfig’ in Run and press Enter to open the System Configuration window in the image directly below.
  3. Click the Selective startup radio button on the General tab.
  4. Then deselect the Load startup items option.
  5. Select the Use original boot configuration option.
  6. Choose the Services tab shown directly below.
  7. Select the Hide all Microsoft services option on the Services tab.
  8. Press the Disable all button to deactivate the third-party software services.
  9. Press the Apply button.
  10. Then click OK to close the window.
  11. Thereafter, a dialog box opens stating that you might need to restart Windows. Press the Restart button on that dialog box to restart the OS.
Читайте также:  Windows forms button array

3. Switch Off the Touch Keyboard Service in Windows

  1. Some users have fixed the on-screen keyboard by switching the Touch Keyboard off service in Windows. To do that, enter ‘services.msc’ in Run and click OK.
  2. Double-click the Touch Keyboard and Handwriting Panel Service on the Services window.
  3. Select the Disabled option on the Startup type drop-down menu.
  4. Click Apply to apply the new setting and press OK to close the window.

4. Edit the Registry

  1. The registry includes a ShowTabletKeyboard DWORD that you can configure with the Registry Editor. Enter ‘regedit’ in Run’s text box and press Return to open the window in the image directly below.
  2. The registry location you need to go to is HKLM (HKEY_LOCAL_MACHINE)\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI.
  3. Double-click ShowTabletKeyboard to open the Edit DWORD window shown in the shot below.
  4. If the value data for the DWORD is 1, delete that value.
  5. Then enter 0 in the Value data box.
  6. Press the OK button to close the Edit DWORD window.

5. Roll Windows Back to a Restore Point

As mentioned, the on-screen keyboard popping up might be due to recently installed third-party software. You can remove recently installed third-party software with the System Restore utility.

That will roll Windows back to a restore point and remove software you installed after the selected date. Thus, System Restore might fix the issue so long as you select a restore point that will remove the software which is opening the on-screen keyboard.

  1. The quickest way to open System Restore is to enter ‘rstrui’ in Run and click OK.
  2. Click Next to open a list of restore points.
  3. Select a restore point that will remove some recently installed software. You can press the Scan for affected programs button to see what software the restore points removes.
  4. Click the Next >Finish to confirm your selected restore point and restart Windows.

If you want to know how to create a system restore point, take a look at this step-by-step guide. A restore point is very useful and can save you from a lot of headaches, so be sure to create one with the help of the above-mentioned guide.

Those resolutions will probably ensure that the on-screen keyboard popping up in Windows 10 won’t happen anymore. However, remember that the on-screen keyboard can come in handy in tablet mode.

You can still manually open it by entering ‘osk’ in Run even when the on-screen keyboard settings aren’t selected in Windows.

If you have any suggestions or questions, don’t hesitate to leave them in the comments section below and we’ll be sure to take a look.

RELATED STORIES TO CHECK OUT:

Оцените статью