I have created a Javascript widget that allows user to embed a calendar on external websites. Right now i'm not handling browser back/forward button in any way, that means that if they click on an event, it is loaded through ajax, but then if they click "back" they are taken to the previous website.
I see two solutions for this
1) keep track of history in a javascript object and then try to detect "back" and "forward" clicks
2) keep track of current state in a url hash. ( like www.xxx.com/events#timely=my-fantastic-event
)
Solution number 2 would allow also bookmarking of events, although i think it would be a still slow as it first would need to load the page and then load the event ( i mean first it load www.xxx.com/events and then it detects the hash and loads the event )
So real case scenario. I have my events on the website www.fantastic-events.com
. I use the javcascript widgets to embed the calendar on www.event-listings.com/events
. When the user clicks on the detail of an event, i could probably push the state i want ( www.event-listings.com/event/my-fantastic-event
) and use History.js to to catch the steate change and load the correct event but that would create an url which is not usable afterwards. I mean that if a user bookmarks www.event-listings.com/event/my-fantastic-event
and visdits it later it won't work because my javascript widget would not be loaded.
Any suggestion/consideration?