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

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

routes - Laravel 4 Wildcard Routing to Different Controllers -

cross browser - XSLT namespace-alias Not Working in Firefox or Chrome -