Want to load popup on homepage only using jQuery in wordpress
<p>I am creating a popup plugin in WordPress. In my plugin, a popup opens on every page but I just want to show it on home page.</p>

<p>I know how to get it in PHP but don't know hot to get the home url in jQuery.</p>

<pre><code>setTimeout(function(){
    if($.cookie('SFPopup') == null){
        $('#sfp_Modal').modal('show');
    }else{          
        $('#sfp_Modal').modal('hide');
    }
}, 3000); 
</code></pre>

<p>This is how I am showing my popup using a cookie condition but I also want to show it only on home page not inner page.</p>

<p><strong>This is my working code</strong></p>

<pre><code>&lt;?php
function sf_display_popup(){
if (is_front_page() == true) {
?&gt;
&lt;script&gt;
    jQuery(document).ready(function($) {
            $.cookieBar();
                setTimeout(function(){
                     //var site_url = '&lt;?php echo home_url(); ?&gt;';

                    if($.cookie('SFPopup') == null || $('body').hasClass('home')){
                        // alert(site_url);
                            $('#sfp_Modal').modal('show');
                        }else{          
                            $('#sfp_Modal').modal('hide');
                        }
                }, 3000); 

        });

&lt;/script&gt;
&lt;?php
    }
}
?&gt;
</code></pre>