For some specific reasons, I would need to automatically add or append a parameter to URL on every request if and only if that parameter already exists in URL since the first request. In other words, if I have the URL /share/page/site/sample/documentlibrary?embedded
, every request to /share/page/site/sample/[whatever]
must contain the embedded parameter plus other parameters that could be added by the original request.
I'm working with Alfresco Share (v4.2.b) what means that the web application already exists and despite of I can perform customization, I have limitations because I don't have full control on it. If it was my web app created from scratch it wouldn't be a problem. According to the restrictions I have, the solution ideally should be as less intrusive as possible. At the same time if it is a JavaScript based solution, the use YUI rather than other library is a plus but not a requirement.
I have been searching looking for an approach and after that I have in mind the next possible solutions:
Using JavaScript by adding the parameter to URL before every page unload. Something like:
window.onbeforeunload = function(e) { // Add parameter to target URL };
But I believe it doesn't work as I was reading and according to some tests I did. It seems there is a sort of security restriction (which makes sense by the way).
By updating the
href
attribute of every link (<a/>
) using JavaScript too, once the page has finished loading. For example,/share/page/site/sample/document-details?nodeRef=workspace://SpacesStore/089acea3-3b37-403d-9a8d-ae484ddd2ccb
could be transformed to/share/page/site/sample/document-details?nodeRef=workspace://SpacesStore/089acea3-3b37-403d-9a8d-ae484ddd2ccb&embedded
. The problem of this solution is that both forms GET or POST and href triggered using JavaScript would be out of scope...Using any URL rewrite technique or library like UrlRewriteFilter (didn't have time yet to test it, sorry).
Create an Alfresco Share extension module which changes or updates every request, maybe with the help of a module or subcomponent evaluator. I don't know if it is doable with extension modules, but I believe I read anywhere that you can perform changes to requests.
I have to add (for those with Alfresco Share knowledge) that options 1, 2 and 4 would be implemented as an extension module.
Well, I hope I have explained good enough my question. I'd strongly appreciate some advice or possible approaches. I will keep working on it anyway and I will come up with any update.