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' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -