<p>I'm currently writing a website that allows people to download Excel and text files. Is there a way to redirect to a different page when they click, so that we run javascript and do analytics (i.e. keep download count)? Currently, nothing prevents the user from simply right-clicking and saving. </p>

<p>Edit: </p>

<p>To be more specific, it would be nice for a single or double click of a file link to redirect to a temporary download page for analytics, then have the file be downloaded.</p>

I'm not sure what you are asking here, are you trying to figure out how to redirect in the controller or are you trying to override the right-click behavior in the browser?
To redirect in the controller you can do something like this documented
here
.
```
```
redirect(controller:"book",action:"list")
```
```
If you are trying to change button or link behavior that's client side and will require some Javascript most likely.
If you clarify I might be able to help more.