Is it possible to somehow call the javascript function after going to a known URL? For example, the user clicks on the link: / user / 1 page is overloaded and the js method is called.

  • explain the problem. checking document.location in window.onload is no good? - zb '
  • Yes - amiss - thanks - Jony

1 answer 1

Maybe the author just wants to do so?

switch(location.pathname) { case '/user/1': func1(); break; case '/user/2': func2(); break; default: func3(); break; }