Magento 1.9 – How to Create a Popup on Homepage Load

formsmagento-1.9popup

edited/updated I need to open this popup when visit home page only..

I tried javascript but doesn't work here..

if ( window.location.pathname == '/' ){
 $( window ).load(function() {
     openFeedbackWindow('feedback_information')

    });
}

I tried more .. like

window.location.href

and php code also in footer.phtml where I load this block..

if(basename($_SERVER['PHP_SELF']=='mywebsiteurl'); ){
load block... 
}

window.location

I need to open this popup when website load now it's open by click on left sidebar button.

enter image description here

here is my code where this popup is triggered..

 <div class="side-feedback">
         <a href="javascript:void(0)" onclick="openFeedbackWindow('feedback_information')" title="Feedback" id="link_feedback"></a> 
    </div>

I try this..

  $( window ).load(function() {
     openFeedbackWindow('feedback_information')

    });

Best Answer

you can try below code it will click your sidebar and popup will load

jQuery( window ).load(function() {
   jQuery('.cms-index-index .side-feedback a').get(0).click();
});
Related Topic