Search code examples
sammy.js

Blocking a Route or URL in Sammy


I am new to Sammy and I would like to know if there is a way to block Sammy from redirecting to a specific route or URL.

There is a method called "setLocation" that is called everytime a redirection is needed. I would like to block the acces to one or more URL.

Can Sammy do it ???

Thanks in advance


Solution

  • Sammy can only do this on known routes buy using the 'before' method on the sammy object (see the sammy docs). In the before you can check if navigation is enabled

    Any other url (www.google.com, www.yourdomain/sammysinglepageapp2 etc) cannot be blocked