How to execute javascript after redirect?


I've got a form with create and preview buttons - both point to create
action, but if create button was pressed, user is redirected to show
action, if preview was pressed user is redirected to edit action.

After redirecting to edit action I'd like to execute some javascript
code, but only if user gets there using preview button. Is there some
smart way to do it or should I simply pass additional parameter (item/
1/edit?preview=true or something like this) and check for it in the


I believe you can see which button was pressed in the params. (It might
be the 'commit' param). You might have to give the buttons the 'name'
attribute for this to work.

Hope this is mildy helpful