Execute javascript function on a specific page

Asked

Viewed 47 times

0

I have a multilingual wordpress site with the plugin WPML need to run a javascript function that calls a modal, only in one of the versions of the site, is it possible that it is executed by the specific url? how can I do that? Thank you.

1 answer

0

First capture the URL of the browser with window.location.pathname javascript function, then check whether the url equals the specified url:

var urlEspecifica = window.location.pathname == "sua url especifica aqui";
if(urlEspecifica ){
   //sua função aqui
 }

Browser other questions tagged

You are not signed in. Login or sign up in order to post.