E
E
ertaquo2010-11-15 22:05:18
JavaScript
ertaquo, 2010-11-15 22:05:18

Browsing History in Javascript?

Is there any way to manage the browsing history (other than going back and forth) in Javascript in at least one of the common browsers? Or is it possible to somehow track the clicks on the back and forth buttons and prevent them from being navigated?
Interested for a web application that actively uses ajax.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sererator, 2010-11-15
@ertaquo

HTML5 to help you:
html5demos.com/history
https://developer.mozilla.org/en/DOM/Manipulating_the_browser_history

L
lugansk, 2010-11-15
@lugansk

>>Is there any way to manage the browsing history (other than going back and forth) in Javascript

history.length
history.go(number)

Also location.replace() rewrites the current history item.
>> Is it possible to somehow track the clicks on the back and forth buttons and prevent them from being navigated?
No. But when you click on the link, you can open a page with a redirect to the target page, respectively, when you click back, we will get to the redirect page and return back. But I don't recommend it, it's annoying.
There is also onunload, but this is even worse.
Of course, if it is possible to expand the entire current story and go where necessary, as in the Opera, then this will not help.

K
Konstantin Kitmanov, 2010-11-15
@k12th

Wouldn't it be better to just handle these transitions carefully? jQuery is full of plugins for this, as well as other frameworks. I'm now starting to use www.asual.com/jquery/address/ - seems pretty good.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question