4

How to detect whether a user is on homepage using javascript/jquery in Osclass classifieds script.

I know similar function is available in osclass php Helpers i.e. osc_is_home_page() but I need something like that in javascript/jquery.

Syed
  • 891
  • 2
  • 8
  • 29
  • 1
    Possible duplicate of [How to run jquery script if html page is the home page...?](http://stackoverflow.com/questions/3713642/how-to-run-jquery-script-if-html-page-is-the-home-page) – Ziki Nov 01 '15 at 16:32
  • I want to know if there exist such a function or technique in Osclass classifieds script to detect whether a user is on homepage using javascript? – Syed Nov 02 '15 at 06:28

1 Answers1

0

enqueue script only if its the home page. Its much more helpful.

if(osc_is_home_page()){
     osc_register_script('script_id', 'scriptUrl', 'dependency');
     osc_enqueue_script('script_id');
  }