This problem comes from the fact that we use ajax to load every content in piwik, so the URL remains the same all the time.
To fix this we can use the # in the URL, the same way Gmail does.
proposal - at least following variables should be persisted in V1: day/period/idSite/module/action - how to implement it? I would suggest the Facebook way (ie. the query after the #, eg. #module=Referers&action=getSearchEngines&idSite=1 etc.) - see http://dev.piwik.org/trac/wiki/HowToTestUI which lists all UI features; good place to start to get a feeling of what is necessary to persist
Currently changing the date in the calendar also changes the currently viewed section (reset to Dashboard).
Instead we should reload the same category.
See Jquery History
jQuery history plugin: It uses the hash (fragment) method that was mentioned earlier in this thread. You essentially need to be able to store some text that encapsulates the current page state so that it can be recreated by the browser on reload; no information beyond that in the URL is maintained in any reliable way. This particular plugin also has the effect of making the "back" and "forward" buttons undo and redo page state changes, which you may or may not want.
kpham, thanks for patch.
I think however code can be improved, especially because in the future we'd like to persist more parameters than period/date/idsite/module/action therefore it should be modular.
<a href="broadcast.changeParameter('module=Referers&action=getKeywords')">View full keywords report</ or <a href="broadcast.changeParameter('date=yesterday&period=day&module=Referers&action=getKeywords')">View full keywords report for yesterday</a>
What do you think about such a design?
Other feedback on the code - updateAnchor has a li_id parameter but it's not used? - for example, calendar.js shouldn't have to do substring matches, it should call a method on the broadcast object (eg. getVariableFromAnchor('date')) that would do the work and return the right variable from the hash, or false - isAnchorExists should return false rather than undefined - getParamValueFromUrl should work well when passed a URL with anchor (ie the api of the object to handle the hash should be very simple to use from outside) - also please have a look at Piwik Coding Standard
let me know what you think.
(In ) - Refresh and back button now work! great contribution by Khanh Pham fixed #103 it's using the jquery history plugin. period, date, idsite, module and action are persisted across requests, making Piwik much nicer and faster to use.
(In ) it should work better with the main broadcast.js file :) refs #5523