jquery - Check if window pathname(url) has specific value -


good day.

i want check if current browser window pathname has specific value or not...

but code not working...any help?

               jquery(function($){                     var pathname = window.location.pathname;                      if ($pathname == 'http://google.com') {                         alert($pathname);                     }                 }); 

thank you

if ($pathname == 'http://google.com') { 

should be

if (pathname == 'http://google.com') { //no $ 

because declared as

var pathname = window.location.pathname; 

Comments

Popular posts from this blog

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

Making Empty C++ Project: General exception (Exception from HRESULT:0x80131500) Visual Studio Community 2015 -

How to fix java warning for "The value of the local variable is not used " -