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

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -