Alex Rivera | Logout

Modify Address Bar URL in AJAX App to Match Current State

Asked 2008-08-04T17:53:32.500
166

I'm writing an AJAX app, but as the user moves through the app, I'd like the URL in the address bar to update despite the lack of page reloads. Basically, I'd like for them to be able to bookmark at any point and thereby return to the current state.

How are people handling maintaining RESTfulness in AJAX apps?

Edit
Report

1 Answer

2

Check if user is 'in' the page, when you click on the URL bar, JavaScript says you are out of page. If you change the URL bar and press 'ENTER' with the symbol '#' within it then you go into the page again, without click on the page manually with mouse cursor, then a keyboard event command (document.onkeypress) from JavaScript will be able to check if it's enter and active the JavaScript for redirection. You can check if user is IN the page with window.onfocus and check if he's out with window.onblur.

Yeah, it's possible.

;)

answered 2010-10-13T23:18:50.833

Your Answer