The official documentation is at: http://docs.alfresco.com
A Basic Sample
var goBack = '<script>history.back();</script>';
This shows the easiest way to achieve the the effect of returning the user back to their original location. However, there are some limitations to this:
- If there are any changes to the node you're referencing such as changes to properties, they will not be visible as this simply relies on the browser's cache to redirect the user back. It effectively is the same as hitting the 'Back' button in the browser.
- Depending on the last browser action taken, it may try to repost data, which could potentially have some undesirable effects, too.
Using External Access Servlet
The remaining sample shows various ways to return to different views of the Alfresco Explorer for spaces and documents utilizing the URL_Addressability#ExternalAccessServlet. The ExternalAccessServlet takes URLs of the form
where outcome can be several appropriate strings. In the below examples, we use browse, showDocDetails, and showSpaceDetails, which are the most common redirections you would need.
Return to Space Browse
var result = '<script>location.href = '/alfresco/navigate/browse/workspace/SpacesStore/' + document.parent.id + '';</script>';
This will return you to the space indicated in the argument. You should be able to see the document you acted upon within this space, as well as all pre-existing documents.
Return to Doc Details
var result = '<script>location.href = '/alfresco/navigate/showDocDetails/workspace/SpacesStore/' + document.id + '';</script>';
This will return you to the details view of the document so that if any changes were made to properties, they would be viewed immediately in the UI. Additionally, you can perform other actions now on the document.
Return to Space Details
var result = '<script>location.href = '/alfresco/navigate/showSpaceDetails/workspace/SpacesStore/' + document.parent.id + '';</script>';
This will return you to the details view of the space for the document.