By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,569 Members | 1,181 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,569 IT Pros & Developers. It's quick & easy.

adding # to the url

P: 46
Hello

I might have a weird problem, but I'm seeking for a solution. I have a form with some inputs. I'm using ajax to call a search data and everything works, but problem is when users use back button because it loads the main search page (without results).

My idea was to store search data or parameters and then recall them when user access the page. As I have

site.com/browse

url, I need to know when user is returning and when it just accessed it. So I was thinking to use

site.com/browse#searching

and by clicking back button, I (site) would know that it's searching. Now how can I add #searching to the url? As I have a form, which also has to work without JS so form (action, mehod) and submit button have to be included. I only know how to add #searching to url with simple link (<a href="#....) but can I add this somehow else?

EDIT: stupid me, some extra googling and trying solved the problem, simple code as

window.location.href = "#searching";

does the job...
Jul 18 '08 #1
Share this Question
Share on Google+
1 Reply


hsriat
Expert 100+
P: 1,654
location.hash is a better option.
Jul 18 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.