If you're using jQuery you could just listen for the window load event and then call the open method for your Magnific Popup like so:

(function($) {
    $(window).load(function () {
        // retrieved this line of code from http://dimsemenov.com/plugins/magnific-popup/documentation.html#api
        $.magnificPopup.open({
            items: {
                src: 'someimage.jpg'
            },
            type: 'image'

          // You may add options here, they're exactly the same as for $.fn.magnificPopup call
          // Note that some settings that rely on click event (like disableOn or midClick) will not work here
        }, 0);
    });
})(jQuery);
Answer from bbone on Stack Overflow
🌐
Dimsemenov
dimsemenov.com › plugins › magnific-popup › documentation.html
Magnific Popup Documentation
Preloader in Magnific Popup is used as an indicator of current status. If option enabled, it’s always present in DOM only text inside of it changes. Below you can see explanation of CSS names that are applied to container that holds preloader and content area depending on the state of current item: /* Content loading is in progress */ .mfp-s-loading { } /* Content successfully loaded */ .mfp-s-ready { } /* Error during loading */ .mfp-s-error { }
Discussions

Magnific Popup on Page Load - javascript
I'm trying to make a Magnific Popup automatically appear on page load. I have it so it works when I click a button (which narrows down some possible errors), but I still can't get it to appear o... More on stackoverflow.com
🌐 stackoverflow.com
magento 2.1 - How to load a popup in the home page? - Magento Stack Exchange
But I also mentioned another thing, that is I want to load all the cities the store can deliver in that popup. I am trying to to get all the attribute values. I created an attribute 'location' to all the products uploaded by admin. Reference site for what I want to achieve, inox movies ... My upper answer is for magnify popup but if you want default magento 2 modal popup on ... More on magento.stackexchange.com
🌐 magento.stackexchange.com
how to load magnific popup modal on page load
I'm trying to load my magnific popup modal on page load, however I can't quite understand the syntax in the documentation. How do I call the modal on page load? My HTML: More on stackoverflow.com
🌐 stackoverflow.com
Load magnific popup on page load - javascript
I'm working on a website, that would like to display a youtube video when someone opens the page (with a delay of 5 seconds) with magnific popup. This is the code that works (thanks to @Yoink!) More on stackoverflow.com
🌐 stackoverflow.com
April 23, 2017
🌐
Kriesi
kriesi.at › home › topics › enfold › open magnific popup automatically when a specific page load
Open magnific popup automatically when a specific page load - Support | Kriesi.at - Premium WordPress Themes
October 20, 2015 - <script> jQuery(window).load(function(){ jQuery.magnificPopup.open({ items: {src: '#PORRA'},type: 'inline'}, 0); }); </script> <div id=”PORRA” class=”white-popup mfp-hide open”> Popup content </div> ... Thanks for this snippet… I think I can use this as well.. In this case I will show how to open the magnific popup on a Menuitem and ue the standard login with the popup (so no other plugin is needed and s on no more cs and js
Top answer
1 of 2
3

I used magnific popup you can download source from Link

VendorName: Prince

ModuleName: Popup

You can see my full Popup module Here: Github

app/code/Prince/Popup/view/frontend/layout/cms_index_index.xml

<?xml version="1.0" ?>
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <link src="Prince_Popup/js/jquery.magnific-popup.min.js"/>
        <css src="Prince_Popup/css/magnific-popup.css"/>   
        <css src="Prince_Popup/css/magnific-animation.css"/>
    </head>
    <body>
        <referenceContainer name="content">
            <block class="Magento\Framework\View\Element\Template" name="index.home" template="Prince_Popup::index/popup.phtml"/>
        </referenceContainer>
    </body>
</page>

app/code/Prince/Popup/view/frontend/requirejs-config.js

var config = {
    map: {
        '*': {
            magnificPopup: 'Prince_Popup/js/jquery.magnific-popup.min',       
            popup: 'Prince_Popup/js/prince_popup'
        }
    },
    shim: {
        magnificPopup: {
            deps: ['jquery']
        }
    }
};

app/code/Prince/Popup/view/frontend/templates/index/popup.phtml

  <div id="popup-content" class="popup-content mfp-with-anim" style="display:none">
      YOUR CONTENT HERE
  </div>

  <script type="text/javascript">
    requirejs(['jquery', 'popup' ],
      function ($, popup) {
          $(document).ready(function(){
              $.magnificPopup.open({
                items: {
                  src: '#popup-content'
                  },
                  type: 'inline',
                  removalDelay: 500
                });
              $('#popup-content').css('display','inline block');
          });
      });
  </script>
2 of 2
2

My upper answer is for magnify popup but if you want default magento 2 modal popup on homepage you need to create this files

app/design/frontend/Vendor/theme/Magento_Cms/layout/cms_index_index.xml

<?xml version="1.0" ?>
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <link src="Magento_Cms/js/popup.js"/>
    </head>
    <body>
        <referenceContainer name="content">
            <block class="Magento\Framework\View\Element\template" name="index.home" template="Magento_Cms::popup.phtml"/>
        </referenceContainer>
    </body>
</page>

app/design/frontend/Vendor/theme/Magento_Cms/templates/popup.phtml

<div id="popup-content" class="popup-content" style="display:none">
    YOUR CONTENT HERE
</div>

app/design/frontend/Vendor/theme/Magento_Cms/web/js/popup.js

require(
    [ 'jquery', 'Magento_Ui/js/modal/modal' ],
    function($, modal) {
        modal({
            autoOpen: true,
            responsive: true,
            clickableOverlay: false,
            modalClass: 'modal-custom',
            title: 'Popup'
        }, $("#popup-content"));
    }
);
🌐
GitHub
github.com › dimsemenov › Magnific-Popup › issues › 985
Use Magnific Popup with AJAX-loaded content · Issue #985 · dimsemenov/Magnific-Popup
Magnific doesn't work with that content because the event listeners fire on page load, but the the AJAX-loaded content is not yet inserted in the page at that point. The only workaround for this that I know of is to use inline javascript on ...
🌐
Dimsemenov
dimsemenov.com › plugins › magnific-popup
Magnific Popup: Responsive jQuery Lightbox Plugin
Magnific Popup displays images before they're completely loaded to take full advantage of progressive loading.
Find elsewhere
🌐
GitHub
github.com › dimsemenov › Magnific-Popup › issues › 168
Popup on page load? · Issue #168 · dimsemenov/Magnific-Popup
July 23, 2013 - dimsemenov / Magnific-Popup Public · Notifications · You must be signed in to change notification settings · Fork 3.5k · Star 11.4k · New issue · Jump to bottom · Closed · level103 opened this issue · Jul 23, 2013 · 1 comment · Closed · level103 opened this issue · Jul 23, 2013 · 1 comment · Copy link · Great code :) Can the popup be displayed on page load?
🌐
GitHub
github.com › dimsemenov › Magnific-Popup › issues › 738
Auto Open Popup on page load? · Issue #738 · dimsemenov/Magnific-Popup
dimsemenov / Magnific-Popup Public · Notifications · Fork 3.6k · Star 11.4k · New issue · Jump to bottom · Open · jezthomp opened this issue · Sep 22, 2015 · 2 comments · Open · jezthomp opened this issue · Sep 22, 2015 · 2 comments · Copy link · Is it possible to load a magnific pop up on page load rather than click?
🌐
Stack Overflow
stackoverflow.com › questions › 53844375 › why-is-content-not-found-when-loading-magnific-popup-on-page-load
jquery - Why is "content not found" when loading magnific popup on page load? - Stack Overflow
<div id="test-modal" class="mfp-hide subscribe__popup"> <div class="subscribe--popup--wrapper"> <p>Content here</p> </div> </div> ... $(document).ready(() => { setTimeout(() => { $.magnificPopup.open({ items: { src: 'test-modal', }, type: 'inline', preloader: true, modal: true, }); }, 5000); }); ... Try with src: '#test-modal', or src: $('#test-modal'), both will work. Note : In src it's value can be HTML string, jQuery object, or CSS selector. $(document).ready(() => { setTimeout(() => { $.magnificPopup.open({ items: { src: $('#test-modal'), }, type: 'inline', preloader: true, modal: true, }); }, 5000); });
🌐
Minddevelopmentanddesign
minddevelopmentanddesign.com › home › the mind blog › how to create a web accessible modal window with magnific popup
How to Create a Web Accessible Modal Window with Magnific Popup
August 29, 2025 - Magnific Popup gives you a few default content types and ways to initialize the popup. We will be using the ‘inline’ content type and initializing our modal through a button click. We want to make sure we are waiting for the document to load before running the script, thus we’ve wrapped it in a jQuery $(‘document’).ready().
Top answer
1 of 1
1

For Exmaple: I used magnify popup to display popup on load page

Namespace: Prince

ModuleName: Popup

1) First of all put js and css files of your popup in web folder of module

app/code/Prince/Popup/view/frontend/web/js/jquery.magnific-popup.min.js
app/code/Prince/Popup/view/frontend/web/css/magnific-popup.css

2) Now define your custom popup js in requirejs-config.js or create new requirejs-config.js file

app/code/Prince/Popup/view/frontend/requirejs-config.js

var config = {
    map: {
        '*': {
            magnificPopup: 'Prince_Popup/js/jquery.magnific-popup.min',       
        }
    },
    shim: {
        magnificPopup: {
            deps: ['jquery']
        }
    }
};

3) Now create template file for popup

app/code/Prince/Popup/view/frontend/templates/index/popup.phtml

<div id="popup-content" class="popup-content mfp-with-anim">
Your Poup Content...............
</div>

<script type="text/javascript">
  requirejs(['jquery', 'magnificPopup' ],
    function ($, magnificPopup) {
        $(document).ready(function(){
            $.magnificPopup.open({
              items: {
                src: '#popup-content'
                },
                type: 'inline',
                removalDelay: 500,
                mainClass: 'mfp-newspaper'
              });
            $('#popup-content').css('display','inline block');
        });
    });
</script>

4) Inject this template file in xml where you need to show popup

for exmaple to show popup on home page. ovveride cms_index_index.xml

<?xml version="1.0" ?>
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <link src="Prince_Popup/js/jquery.magnific-popup.min.js"/>
        <css src="Prince_Popup/css/magnific-popup.css"/>
    </head>
    <body>
        <referenceContainer name="content">
            <block class="Magento\Framework\View\Element\Template" name="index.home" template="Prince_Popup::index/popup.phtml"/>
        </referenceContainer>
    </body>
</page>
🌐
GitHub
github.com › dimsemenov › Magnific-Popup › issues › 1031
How do you call the iframe popup when its loaded dynamically · Issue #1031 · dimsemenov/Magnific-Popup
October 5, 2017 - //getting only present DOM element on page load $(document).ready(function() { $('.popup-webcam').magnificPopup({ disableOn: 0, type: 'iframe', mainClass: 'mfp-fade', removalDelay: 160, preloader: false, fixedContentPos: false }); }); Reactions are currently unavailable ·
Author   Chijioke11
🌐
SitePoint
sitepoint.com › javascript
Magnific Popup - loading content from external page via ajax into a slideshow
January 19, 2015 - I’m struggling with this little bit…I made a page that has a div with some images inside of it. Similar to this: I have another page that has a button that would load this page and then i want to load the above list of photos into the Magnific Popup slideshow to show them one by one. The ...