Javascript Library to Control Popup in Web Browser

popupwindow.js is a JavaScript library for programmatically creating, opening, and closing browser popup windows.

How to make use of it:

1. Download and import the popup_window.js JavaScript library.

<script src="popup_window.js"></script>

2. Create a new instance and specify the path to the web page to be displayed in the popup.

const win = new PopupWindow({
      url: '/path/to/url/'
});

3. Open a new popup.

win.open();

4. Close the popup.

win.close();

5. Silently close the popup.

win.closeSilently();

6. It also supports form-based popups.

<form name="form_demo" method="GET">
  <ul>
    <li>
      <section>
        <label for="text-data1">Data1</label>
        <input id="text-data1" type="text" name="data1" value="defaultValue1">
      </section>
    </li>
    <li>
      <section>
        <label for="text-data2">Data2</label>
        <input id="text-data2" type="text" name="data2" value="defaultValue2">
      </section>
    </li>
  </ul>
</form>
const win = new PopupWindow({

      // the form
      form: document.form_demo,

      // action attribute of the form
      url: url, 

      // name of the opened window
      name: 'demo', 
      
});

7. Options available to customize the popup.

const popupClosedEventWatchingInterval = 500; // ms
const moduleName = 'PopupWindow';
const defaultUrl = 'about:blank';
const features = {
  width: 500, // px
  height: 500, // px
  toolbar: false, // no
  menubar: false, // no
  scrollbars: true, // yes
  resizable: false, // no
  location: false, // no
  directories: false, // no
  status: false, // no
};

8. Callback functions.

const win = new PopupWindow({
      url: '/path/to/url/',
      onBeforeOpen: function() {
        // do something
      },
      onAfterOpen: function() {
        // do something
      },
      onAfterClose: function() {
        // do something
      },
});

 


See Demo And Download

 

Official Website(niceman114): Click Here

This superior jQuery/javascript plugin is developed by niceman114. For extra Advanced Usages, please go to the official website.

Related Posts

Floating-Whatsapp-Chat-Button

How to Add Floating Whatsapp Chat Button In HTML | venom-button

Venom Button is a very simple plugin for the jQuery floating WhatsApp button. Adds a floating button to your site that calls WhatsApp Click to Chat API. It will automatically start the WhatsApp…

Data-Table-Generator-Tabulator

Interactive Data Table Generator with JS/jQuery and JSON | Tabulator

Tabulator allows you to create interactive tables in seconds from any HTML Table, JavaScript array, AJAX data source, or JSON format data. Just include the library in your…

alert-confirm-prompt-attention-js

Simple Alert, Confirm, Prompt Popup Using Vanilla JavaScript Library | attention.js

JavaScript provides various built-in functionality to display popup messages for different purposes. Attention JS is a vanillaJS plugin used to create a custom alert, confirm, or Prompt…

Bootstrap-4-Sidebar-Menu-Responsive-Template

Bootstrap 4 Sidebar Menu Responsive Template | MDB

Bootstrap Side Navbar – Responsive sidebar template based on the Bootstrap 4 framework. An easy-to-use, totally responsive, Google Material Design impressed aspect navigation for modern web app…

Bootstrap-4-Toast-Notification-Plugin

Lightweight Bootstrap 4 Toast Notification Plugin | BS4 Advanced Toast

A lightweight Bootstrap 4 Toast Notification plugin integrated with JS/jQuery. bs4-toast.js is a JavaScript library that enhances the native Bootstrap toast component with icons, buttons, callbacks, and…

Audio-Visualizations-Wave

How to Create Audio Visualizations with JavaScript | Wave.js

Audio Visualizer Library – wave.js is a vanilla javascript audio visualization library that provides 20+ creative audio visualization effects to bring more engagement to your visitor. Contribute…

Leave a Reply

Your email address will not be published. Required fields are marked *