In the article "Passing an additional parameter to a .NET dll or ASP page from tab and buttons."
I discussed how you can add additional flags to URLs. These additional parameters may also be added to URLs when a page is redirected or as a button is built dynamically.
These parameters can be read by the Client Side API just like any system parameter or context information.
The API has a method called "getArgs()" that allows the URL to be parsed very easily.
var contextInfo = crm.getArgs();