views:

65

answers:

2

Hi, i use Javascript(AJAX) and want to change the addressbar Ex: http://mywebsite.com to http//mywebsite.com?web=info

+1  A: 

You don't want ajax just do this:

window.location = "http://mywebsite.com?web=info";
Hogan
+1  A: 

you can not change the url without the page actually redirecting. You can however append a hashtag to the url.

http://mywebsite.com to http://mywebsite.com#something

See this question on StackOverflow.

http://stackoverflow.com/questions/2366481/attaching-hashtag-to-url-with-javascript

jhanifen
No, i don't want to change hash, just ?web=info
Snoob
@jhanifen : a "hashtag"? Isn't that something used in twitter? I believe in URLs that is called an anchor
Hogan
Well obviously twitter has made the term hashtag associated with a tweet. But #something in a url is also referred to as a hashtag.
jhanifen
@Snoob - You can not add ?web=info to the url without the page actually changing. If you don't mind the page changing then @Hogan's answer below is correct.
jhanifen
This isn't true anymore, at least in webkit (and others as they evolve), see this question: http://stackoverflow.com/questions/3849758/what-is-this-technology-facebook
Nick Craver
If you are only supporting "Good" browsers then that is definitely a possibility.
jhanifen