Event on anchor change(click back button) in URL

G

gvrajkumar

Hi

We are developing an Ajax based application. In this application the
URL is fixed and as user navigates on the application we will change
Anchor on the URL so that user can bookmark the url and can load the
page on demand.

When user refreshes the page we have no issue in the populating the
page based on the anchor in URL as on load we can capture the
hash(#anchor) and act accordingly.

sample URL: http://www.google.com/somecontext#<anchor>

When the user clicks back button anchor is changing but not able to
know where to get callback.
Is there any event or way I can find when the user has clicked back
button.

Any help is appreciated. Thanks in advance.

Thanks
Venkat Gunnu
 
D

Darko

Hi

We are developing an Ajax based application. In this application the
URL is fixed and as user navigates on the application we will change
Anchor on the URL so that user can bookmark the url and can load the
page on demand.

When user refreshes the page we have no issue in the populating the
page based on the anchor in URL as on load we can capture the
hash(#anchor) and act accordingly.

sample URL:http://www.google.com/somecontext#<anchor>

When the user clicks back button anchor is changing but not able to
know where to get callback.
Is there any event or way I can find when the user has clicked back
button.

Any help is appreciated. Thanks in advance.

Thanks
Venkat Gunnu

No, you can't do that. It's been talked about a lot on various
Internet sites lately, since Ajax became popular. What you CAN do, and
what people usually do, is set an interval do check the value of
location.href every 200 ms or similar, and when the user clicks back
the monitor (the object that checks the value of href) will notice
that soon and act accordingly. It works just fine.
 
D

David Mark

No, you can't do that. It's been talked about a lot on various
Internet sites lately, since Ajax became popular. What you CAN do, and
what people usually do, is set an interval do check the value of
location.href every 200 ms or similar, and when the user clicks back

This sounds crazy to me. Why try to make the browser interface do
something it wasn't designed to do? If you are going to write a Web
application that runs on a single page, you need to provide a suitable
navigation interface. By the same token, you can provide a
bookmarking interface that tacks on a hash without polluting the
browser's navigation history.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top