There are a couple of implementations of this "ajax history" type of functionality already out there.

For Mootools 1.2:

http://www.nmjenkins.com/code/

For Mootools 1.11 with Multiple Widgets:

http://digitarald.de/project/history-manager/

Jay

asgaroth.belem wrote:
Thanks, I've solved the problem...






 (I hate when people say that and dont post the solution xD )

So make some clean and stable code before posting it here, Just in
case someone has the same problem and ends up here he gets some semi-
real solution and not just ideas. (as it happens most of the times...
havent you get to a site from google which title is the same thing you
are looking for, and then you end up in a forum which last post is ..
thanks i solved the problem, or I have a solution ill pm it to you )


thanks all for your help.


On 22 mayo, 09:55, Fábio Costa <[email protected]> wrote:
Unfortunatelly i dont think that the hash part of the URL goes to the
server.
You will always have to process this using javascript and send ajax request
to proper change your content.
You could do a Browser Hash class (soething like that) that on its set
Method changes the location.hash properly and process the passed value in a
way that will generate a queryString that then is passed to the server using
the Mootool Request (aka Ajax).

Fábio Miranda Costa
Engenheiro de Computaçãohttp://meiocodigo.com

On Fri, May 22, 2009 at 11:50 AM, asgaroth.belem
<[email protected]>wrote:



Thanks for all the replies.
Fabio: Yeah I had some code with the hash thing but I didnt understand
how it worked exactly so it ended up going to that address., now that
I know ill check how can I use it properly.
Sandy: Thats also true. I have taken that into account already, when I
call the content from ajax I also send an extra parameter
( remote=true ) so that the controller knows if he has to render the
view with or without the full template or just the needed content.
rpflo: Yes I meant hitting the refresh button or pressing F5. So far It looks like this, correct me if im wrong: The address in the bar will ALWAYS bewww.server.com/homebut it can
change towww.server.com/home#store,www.server.com/home#contact
etc... as I navigate with the menu.
So what I have to do is to rather use a combination of htaccess and
server side logic to load the content, or have javascript handle the
logic of processing the hash and load the proper content.
That way If the user types for examplewww.server.com/storeI can
render the correct view, and the user will also have the ability to
navigate from there as in any other URL setting hash to something like
www.server.com/store#home orwww.server.com/store#contact.
Is that correct? Than ks everyone for their help =] Alex, On May 22, 6:45 am, Fábio Costa <[email protected]> wrote:
if the new hash is '' then you should set it to '#'.
Wont reload and works fine. Fábio Miranda Costa
Engenheiro de Computaçãohttp://meiocodigo.com
On Fri, May 22, 2009 at 4:58 AM, Thierry bela nanga <[email protected]
wrote:
it looks like setting hash to an empty string cause the page to reload
in
FF, I have not tested it in other browsers
On Thu, May 21, 2009 at 9:30 PM, rpflo <[email protected]> wrote:
I'm having a little trouble understanding ...
"the content changes but the page doesnt reloads so the adrees in the
bar remainswww.server.com/home.
I want that when the user reloads the page it goes to
www.server.com/contact
and notwww.server.com/home."
When you say "reloads" in the second paragraph do you mean the ajax
request or they actually hit refresh/reload?
If you mean the ajax request (and not an actual reload), you can't
change the text in the address bar with javascript.  So as the user
clicks the address bar will always readwww.server.com/home.
If you want that to change as they click you could use
www.server.com/#contact
(as mentioned by Sandy).
If you want the user to be able to type inwww.server.com/contactyou
could use a combination htaccess and php to load the proper content.
On May 21, 2:10 pm, Sanford Whiteman <[email protected]>
wrote:
I want that when the user reloads the page it goes
towww.server.com/contact
and notwww.server.com/home.
You  cannot  change  the  hostname  or  path  that "would be"
reloaded
without  actually  reloading  the document. In other words, you
cannot
rewrite  the  main  content  of  the  location bar/textbox without
the
browser also going to that location.
The exception is the # hash. Changing the hash will not reload
from
scratch.  But  your URLs are not currently constructed to use the
hash
to  determine the inner content. If you change this structure, it
will
work.
--Sandy
--
fax : (+33) 08 26 51 94 51


Reply via email to