10 examples of 'automatically open popup window on page load' in JavaScript

Every line of 'automatically open popup window on page load' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
5function loadPopup(page_url){
6 //loads popup only if it is disabled
7 if(popupStatus==0){
8 jQuery("#backgroundPopup").css({
9 "opacity": "0.7"
10 });
11 jQuery("#backgroundPopup").fadeIn("slow");
12 jQuery("#popupContent").fadeIn("slow");
13 jQuery("#contentArea").attr("src", page_url);
14 popupStatus = 1;
15 }
16}
26function openPopup (href) {
27 if (window.popup && !window.closed) window.popup.close();
28 var width = 1000;
29 var height = 800;
30 var x = (screen.width / 2) - (width / 2);
31 var y = (screen.height / 2) - (height / 2);
32 var win = new BrowserWindow({
33 width, height, x, y,
34 center: true,
35 autoHideMenuBar: true,
36 webPreferences: {
37 webSecurity: true,
38 nodeIntegration: false,
39 plugins: true,
40 },
41 });
42 win.id = 'popup';
43 win.loadURL(href);
44 window.win = win;
45 /*
46 nw.Window.open('app/popup.html?href=' + encodeURIComponent(href), {x: left, y: top, width: w, height: h},
47 function (win) {
48 window.popup = win.window;
49
50 // do not open the window and open it in external browser
51 win.on('new-win-policy', function (frame, url, policy) {
52 policy.ignore();
53 nw.Shell.openExternal(url);
54 });
55
56 win.window.id = 'popup';
57 win.window.config = App.config;
58 win.focus();
59 });
60 */
61}
4function popUp(URL) {
5 day = new Date();
6 id = day.getTime();
7 eval("page = window.open(URL, 'xqdoccode', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=600,height=400,left = 412,top = 334');")
8 page.focus();
9}
4function loadPopup() {
5 // loads popup only if it is disabled
6 if (popupStatus == 0) {
7 jQuery("#backgroundPopup").css({
8 "opacity" : "0.7"
9 });
10 jQuery("#backgroundPopup").fadeIn("slow");
11 jQuery("#popupChooser").fadeIn("slow");
12 popupStatus = 1;
13 }
14}
37function popup(page, width, height) {
38 window.open(page, '', "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width="+width+", height="+height+", left="+xcenter(width)+", top="+ycenter(height));
39}
1function createPopup(tabID) {
2 chrome.pageAction.setTitle({tabId:tabID,title:"Star page"});
3
4 chrome.tabs.get(tabID, function(tab) {
5 chrome.bookmarks.search({url: tab.url}, function(results) {
6 if (results.length >= 1) {
7 chrome.pageAction.setIcon({tabId:tabID,path:"icons/collected19.png"});
8 }else{
9 chrome.pageAction.setIcon({tabId:tabID,path:"icons/collected19_hollow.png"});
10 }
11
12 chrome.pageAction.setPopup({tabId:tabID, popup:"popup.html"});
13 chrome.pageAction.show(tabID);
14 });
15 });
16}
315function windowPopup(url, width, height) {
316 var left = screen.width / 2 - width / 2,
317 top = screen.height / 2 - height / 2;
318 window.open(url, "", "menubar=no,toolbar=no,resizable=yes,scrollbars=yes,width=" + width + ",height=" + height + ",top=" + top + ",left=" + left);
319}
1export function windowPopup(url: string, width: number, height: number) {
2 // Calculate the position of the popup so
3 // it’s centered on the screen.
4 var left = screen.width / 2 - width / 2,
5 top = screen.height / 2 - height / 2;
6 window.open(
7 url,
8 '',
9 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,width=' +
10 width +
11 ',height=' +
12 height +
13 ',top=' +
14 top +
15 ',left=' +
16 left
17 );
18}
51function openPopup_images(pageUrl) {
52window.open( pageUrl,
53 "tastPopupHelp",
54 "resizable=yes, " +
55 "location=no, " +
56 "status=no, " +
57 "width=950, " +
58 "height=750", +
59 "scrollbars=yes").focus();
60}
37function popupwin(content) {
38 op = window.open();
39 op.document.open('text/plain');
40 op.document.write(content);
41 op.document.close();
42}

Related snippets